It's not a secret anymore!*
The moose likes EJB and other Java EE Technologies and the fly likes Is j2ee 1.3.1 RI broken for handling many:many CMR? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Is j2ee 1.3.1 RI broken for handling many:many CMR?" Watch "Is j2ee 1.3.1 RI broken for handling many:many CMR?" New topic
Author

Is j2ee 1.3.1 RI broken for handling many:many CMR?

Bill Pugh
Greenhorn

Joined: Jul 10, 2003
Posts: 12
Does anyone know if the j2ee 1.3.1 RI is broken in its handling of many:many CMR?
Here is the problem I'm trying to implement. I have a PersonBean, and a many:many CMR for which people each person knows. This is represented by virtual persistent fields:
public abstract Set getKnows();
public abstract void setKnows(Set c);
The ejb-relationship is specified as:
<ejb-relation>
<description>Which other people a person knows. Not symmetrical.</description>
<ejb-relationship-role>
<ejb-relationship-role-name>PersonBean</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>PersonBean</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>knows</cmr-field-name>
<cmr-field-type>java.util.Set</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>PersonBean</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>PersonBean</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
The problem is that the table the deploytool generates to handle the many:many relationship is wrong. It only contains one column, so it can't represent a many:many relationship. Here is the command to create the table (from sun-j2ee-ri.xml):
<sql-statement>
<operation>createTable</operation>
<sql>CREATE TABLE "PersonBean_knows_PersonBean_Table" ("_PersonBean_personID" INTEGER, CONSTRAINT "pk_PersonBean_knows_PersonBean_Tabl" PRIMARY KEY ("_PersonBean_personID") )</sql>
</sql-statement>
If I had to guess, I'd say that the 1.3.1 deploytool can't handle a CMR many:many relationship from a bean to itself.
Can anyone confirm this, or point me to my problem? Should I try using the 1.4 implementation?
Thanks,
Bill Pugh
 
jQuery in Action, 2nd edition
 
subject: Is j2ee 1.3.1 RI broken for handling many:many CMR?
 
Similar Threads
A CMR collection may only be used within the transction in which it was created
EJB Relation Question
URGENT HELP in EJB-QL USING WEBLOGIC 8.1
is there anything wrong here ?
CMR configuration confusion