Bugs item #1071332, was opened at 2004-11-23 00:42
Message generated for change (Comment added) made by loubyansky
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=1071332&group_id=22866

Category: JBossCMP
Group: v4.0
Status: Open
>Resolution: Works For Me
Priority: 5
Submitted By: Jasmine (kongdy)
>Assigned to: Alexey Loubyansky (loubyansky)
Summary: CMR and ejbCreate

Initial Comment:
Hi,

I have a problem regarding CMR.  As for example, I have 
two tables “Test” and “TestParams”.  The tables 
definitions are as follows:

Test
test_id varchar(20) not null– primary key
test_name varchar(20) not null

TestParams
test_id varchar(20) not null – primary key (references to 
testID in Test)
examiner varchar(20) not null – primary key
length int not null


I am trying to establish a 1:N relationship between 
them.  I have the relevant getters and setters in the 
two entity beans.

Getters/Setters in Test:
public abstract Collection getTestParamLists();
public abstract void setTestParamLists(Collection 
testParamLists);

Getters/Setters in TestParams:
public abstract TestLocal getTest();
public abstract void setTest(TestLocal test);

Below are the extracts from the ejb-jar and jbosscmp-
jdbc:

Ejb-jar:

<relationships>
   <ejb-relation>
     <ejb-relation-name>Test-TestParams</ejb-relation-
name>
     <ejb-relationship-role>
       <description>Test</description>
       <ejb-relationship-role-name>Test-has-
Params</ejb-relationship-role-name>
       <multiplicity>One</multiplicity>
       <relationship-role-source>
         <description>test</description>
         <ejb-name>Test</ejb-name>
       </relationship-role-source>
       <cmr-field>
          <description>paramLists</description>
          <cmr-field-name>paramLists</cmr-field-name>
          <cmr-field-type>java.util.Collection</cmr-field-
type>
       </cmr-field>
     </ejb-relationship-role>
     <ejb-relationship-role>
       <description>Test</description>
       <ejb-relationship-role-name>Params-belong-to-
Test</ejb-relationship-role-name>
       <multiplicity>Many</multiplicity>
       <relationship-role-source>
         <description>testParams</description>
         <ejb-name>TestParams</ejb-name>
       </relationship-role-source>
       <cmr-field>
         <description>test</description>
         <cmr-field-name>test</cmr-field-name>
       </cmr-field>
     </ejb-relationship-role>
   </ejb-relation>
 </relationships>


jbosscmp-jdbc:

<relationships>
          <ejb-relation>
            <ejb-relation-name>Test-TestParams</ejb-
relation-name>
            <ejb-relationship-role>
              <ejb-relationship-role-name>Test-has-
Params</ejb-relationship-role-name>
              <key-fields>
                <key-field>
                  <field-name>testId</field-name>
                  <column-name>test_id</column-name>
                </key-field>
              </key-fields>
            </ejb-relationship-role>
            <ejb-relationship-role>
              <ejb-relationship-role-name>Params-belong-
to-Test</ejb-relationship-role-name>
            </ejb-relationship-role>
          </ejb-relation>
        </relationships>

I tried to create a Test bean and a TestParams bean by 
issuing the following codes:
TestLocal newTest=testLocalHome.create(testobject);
testParamsLocalHome.create(paramObject, newTest);

The Test bean is successfully created, but not the 
TestParams bean.
I got the following error:

javax.ejb.CreateException: javax.ejb.CreateException: 
Could not create entity:java.sql.SQLException: Unknown 
column 'test' in 'field list'

I looked at the log file and it has the following info:
Executing SQL: INSERT INTO TEST_PARAMS (test_ID, 
examiner, length, test) VALUES (?, ?, ?, ?)

It seems like Jboss thinks that my cmr field is a cmp 
field?  What do I need to change?

Any help is appreciate.


----------------------------------------------------------------------

>Comment By: Alexey Loubyansky (loubyansky)
Date: 2004-11-23 12:08

Message:
Logged In: YES 
user_id=543482

attach a testcase, please

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=1071332&group_id=22866


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to