Data contains multiple values, but this cmr field is single
jamarkha Feb 17, 2003 3:27 PMI've read the other posts in this forum about the subject exception message but please forgive me, I can't seem to either discern the answer (I've purchased the docs and read Chapter 6 over and over) nor overcome the problem.
I have a 1-to-1 unidirectional relationship (User-->Department) and I get the exception during ejbPostCreate.
My environment:
JBoss 3.2.0RC1 w/embedded Tomcat 4.1.18
Sun JDK 1.4.1-b21
PostgreSQL 7.3
---------------------
ejb-jar.xml
---------------------
<ejb-relation >
<ejb-relation-name>departments-pfinet_users</ejb-relation-name>
<ejb-relationship-role >
<ejb-relationship-role-name>pfinet_user-has-department</ejb-relationship-role-name>
One
<relationship-role-source >
<ejb-name>PfinetUser</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>department</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role >
<ejb-relationship-role-name>department-has-pfinet_user</ejb-relationship-role-name>
One
<relationship-role-source >
<ejb-name>Department</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
---------------------
jbosscmp-jdbc.xml
---------------------
<ejb-relation>
<ejb-relation-name>departments-pfinet_users</ejb-relation-name>
<foreign-key-mapping/>
<ejb-relationship-role>
<ejb-relationship-role-name>pfinet_user-has-department</ejb-relationship-role-name>
<fk-constraint>true</fk-constraint>
<key-fields/>
<read-ahead>
on-load
</read-ahead>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>department-has-pfinet_user</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>id</field-name>
<column-name>department</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
</ejb-relation>
---------------------
Entity EJB snippet where 'Department' is the local interface for the Department entity.
---------------------
...
public PfinetUserPK ejbCreate(PfinetUserValue data, Department department) throws CreateException
{
setUserId(data.getUserId());
setPfinetUserValue(data);
return null;
}
public void ejbPostCreate(PfinetUserValue data, Department department) throws CreateException
{
setDepartment(department);
}