大侠留步,请问JBoss中CMR使用的问题

03-05-23 richard_hw2000

在JBoss中使用1对1的关联CMR时,进行数据插入时JBoss报出如下错误,请问如何解决:小弟的疑惑是userinfo是CMR的字段,和数据库表本身字段有什么区别呢,为什么会有这样的问题,急,盼复谢谢。

16:25:58,875 ERROR [TblUser] Could not create entity

java.sql.SQLException: Column (userinfo) not found in any table in the query (or SLV is undefined).

实体Bean TblUser对应表的字段为email(PK),password

TblUserinfo对应表的字段为emali(PK),firstname,lastname,addr

调用代码:

TblUser user = userHome.create(email,password);

TblUserinfo info = infoHome.create(email,firstname,lastname,addr);

ejb-jar.xml 有关releationship的描述如下:

<relationships>

<ejb-relation>

<ejb-relation-name>tblUser-tblUserinfo</ejb-relation-name>

<ejb-relationship-role>

<description>tblUser</description>

<ejb-relationship-role-name>TblUserRelationshipRole</ejb-relationship-role-name>

<multiplicity>One</multiplicity>

<relationship-role-source>

<description>tblUser</description>

<ejb-name>TblUser</ejb-name>

</relationship-role-source>

<cmr-field>

<description>tblUserinfo</description>

<cmr-field-name>userinfo</cmr-field-name>

</cmr-field>

</ejb-relationship-role>

<ejb-relationship-role>

<description>tblUserinfo</description>

<ejb-relationship-role-name>TblUserinfoRelationshipRole</ejb-relationship-role-name>

<multiplicity>One</multiplicity>

<relationship-role-source>

<description>tblUserinfo</description>

<ejb-name>TblUserinfo</ejb-name>

</relationship-role-source>

</ejb-relationship-role>

</ejb-relation>

</relationships>

jbosscmp-jdbc.xml中有关releationship的描述如下:

<relationships>

<ejb-relation>

<ejb-relation-name>tblUser-tblUserinfo</ejb-relation-name>

<foreign-key-mapping />

<ejb-relationship-role>

<ejb-relationship-role-name>TblUserRelationshipRole</ejb-relationship-role-name>

<key-fields>

<key-field>

<field-name>email</field-name>

<column-name>email</column-name>

</key-field>

</key-fields>

</ejb-relationship-role>

<ejb-relationship-role>

<ejb-relationship-role-name>TblUserinfoRelationshipRole</ejb-relationship-role-name>

</ejb-relationship-role>

</ejb-relation>

</relationships>