Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Bill Pugh
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic