-
1. Re: Create/Insert is incorrect. jboss3.0 RC1
pandawong007 Apr 26, 2002 4:41 PM (in response to pandawong007)I can create an entity bean if there is no relation. but i cant if a relationship exists.
-
2. Re: Create/Insert is incorrect. jboss3.0 RC1
dsundstrom Apr 26, 2002 7:43 PM (in response to pandawong007)Change the name of the column.
You can not map a cmr field to a cmp field or a cmr field to a pk column. Don't try it. It doesn't work. -
3. Re: Create/Insert is incorrect. jboss3.0 RC1
satria Oct 24, 2002 10:25 AM (in response to pandawong007)> Change the name of the column.
>
> You can not map a cmr field to a cmp field or a cmr
> field to a pk column. Don't try it. It doesn't work.
hi dsundstrom,
can you explain in more detail about your statement, because i got a similar problem and haven't been able to solve it, the problem is like this:
in the server.log:
2002-10-24 21:12:03,119 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.ProductInsEJB] Executing SQL: INSERT INTO tbl_prod_ins (prod_ins_id, invst_typ_id, principal_id, prod_ins_nm, investmentType, thePrincipal) VALUES (?, ?, ?, ?, ?, ?)
while actually my tbl_prod_ins consist only the first 4 fields, and i dont have any idea where the last 2 fields are coming from.
it happens since i tried to have a relationship between tbl_prod_ins and tbl_invst_typ(invst_typ_id, dscp) and tbl_principal(principal_id, dscp).
fyi, i put in the jbosscmp-jdbc.xml:
<ejb-relation>
<ejb-relation-name>ProductIns-InvestmentType</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>ProductIns-typeof-InvestmentType</ejb-relationship-role-name>
Many
<cascade-delete />
<relationship-role-source>
<ejb-name>ProductInsEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>investmentType</cmr-field-name>
<cmr-field-type>java.util.Set</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>InvestmentType-has-ProductIns</ejb-relationship-role-name>
One
<relationship-role-source>
<ejb-name>InvestmentTypeEJB</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
<ejb-relation>
<ejb-relation-name>ProductIns-ThePrincipal</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>ProductIns-owned-by-ThePrincipal</ejb-relationship-role-name>
Many
<cascade-delete />
<relationship-role-source>
<ejb-name>ProductInsEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>thePrincipal</cmr-field-name>
<cmr-field-type>java.util.Set</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>ThePrincipal-has-ProductIns</ejb-relationship-role-name>
One
<relationship-role-source>
<ejb-name>ThePrincipalEJB</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
any idea?
.satria. -
4. Re: Create/Insert is incorrect. jboss3.0 RC1
satria Oct 24, 2002 10:27 AM (in response to pandawong007)oopss sorry that one is in my ejb-jar.xml
while in my jbosscmp-jdbc.xml:
<ejb-relation>
<ejb-relation-name>ProductIns-InvestmentType</ejb-relation-name>
<foreign-key-mapping/>
<ejb-relationship-role-name>ProductIns-typeof-InvestmentType</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>investmentType</field-name>
<column-name>invst_typ_id</column-name>
</key-field>
</key-fields>
<ejb-relationship-role-name>InvestmentType-has-ProductIns</ejb-relationship-role-name>
<key-fields>
</key-fields>
</ejb-relation>
<ejb-relation>
<ejb-relation-name>ProductIns-ThePrincipal</ejb-relation-name>
<foreign-key-mapping/>
<ejb-relationship-role-name>ProductIns-owned-by-ThePrincipal</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>thePrincipal</field-name>
<column-name>principal_id</column-name>
</key-field>
</key-fields>
<ejb-relationship-role-name>ThePrincipal-has-ProductIns</ejb-relationship-role-name>
<key-fields>
</key-fields>
</ejb-relation>
.satria.