Hi All,
 
I could use a little help with that scarcely documented feature - CMR.  When I understand this, I'd like to submit a document that defines all seven of the CMR types identified for EJB CMP 2.1.  I've had a lot of struggles with this and have found very scarce documentation on how Geronimo handles it with OpenEJB and the TranQL library.  Some good examples are needed that identify the realitonship between the ejb-jar.xml and the openejb-jar.xml <relationships> components.
 
I think my problem is a result of the concatenated Primary key.  I get a DeploymentException from the OpenEJB SchemataBuilder.buildSchemata with the following additional info:
 
Caused by: org.apache.geronimo.common.DeploymentException: Role Relation Name [User-CommitteeMembers]; Role Name [User-has-many-CommitteeMemberships]; EJB [UserEntity]; CMR field [committeeMemberships] is misconfigured: primary key column [CommitteeId] is not mapped to a foreign key.
at org.openejb.deployment.SchemataBuilder.extractJoinInfo(SchemataBuilder.java:724)
at org.openejb.deployment.SchemataBuilder.processRelationships(SchemataBuilder.java:661)
at org.openejb.deployment.SchemataBuilder.buildSchemata(SchemataBuilder.java:184)
 
 
How do I get this to work?  Essentially, I have two Bi-Directional Relationships on a 3NF One<->Many<->One relationship.  I know this could be done with a Many-To-Many, but I forsee Database growth with potential attributes on the realtionship table.
 
Thanks for the assistance from you DB/EJB CMP guru's!
 
 
 
I have the following DB Schema:
 
-- CreateBoardDatabase.sql
-- Script to Create Board Of Trustees MySQL Database
-- Create and Use the Database
CREATE DATABASE BoardOfTrustees;
USE BoardOfTrustees;
 
-- Create Base Table Structure
-- Users
CREATE TABLE Users
  (UserId VARCHAR(32) NOT NULL PRIMARY KEY,
  User_Name VARCHAR(64) NOT NULL,
  User_Password VARCHAR(32) NOT NULL,
  User_FirstName VARCHAR(32),
  User_LastName VARCHAR(32),
  User_Title VARCHAR(32),
  User_EMail VARCHAR(64),
  User_ImgFileName VARCHAR(128),
  User_ImgFileMimeType VARCHAR(64),
  User_ImgFileLength INT,
  User_ImgFileChecksum INT);
 
-- Committees
CREATE TABLE Committees
  (CommitteeId VARCHAR(32) NOT NULL PRIMARY KEY,
  Committee_Name VARCHAR(64) NOT NULL);
 
-- Committee_Members
CREATE TABLE Committee_Members
  (CommitteeId VARCHAR(32) NOT NULL,
  UserId VARCHAR(32) NOT NULL,
  PRIMARY KEY(CommitteeId, UserId),
  CONSTRAINT FK_committees_members_committees FOREIGN KEY (CommitteeId) REFERENCES Committees(CommitteeId),
  CONSTRAINT FK_committees_members_users FOREIGN KEY (UserId) REFERENCES Users(UserId));
 
 
I have three CMP Entity Beans defined - Committees, Committee_Members, Users.  The Committee_Members has a PKey class composed of the CommitteeId and the UserId.
 
I have the following ejb-jar.xml excerpts:
 
<entity >
<description><![CDATA[Description for UserEntity]]></description>
<display-name>Name for UserEntity</display-name>

<ejb-name>UserEntity</ejb-name>
<home>net.iluviya.boardoftrustees.interfaces.UserEntityHome</home>
<remote>net.iluviya.boardoftrustees.interfaces.UserEntity</remote>
<local-home>net.iluviya.boardoftrustees.interfaces.UserEntityLocalHome</local-home>
<local>net.iluviya.boardoftrustees.interfaces.UserEntityLocal</local>
<ejb-class>net.iluviya.boardoftrustees.ejb.UserEntityCMP</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>net.iluviya.boardoftrustees.interfaces.UserEntityPK</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>UserEntity</abstract-schema-name>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>userId</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>userName</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>userPassword</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>userFirstName</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>userLastName</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>userTitle</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>userEMail</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>userImgFileName</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>userImgFileMimeType</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>userImgFileLength</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>userImgFileCheckSum</field-name>
</cmp-field>
<query>
<description><![CDATA[findByName]]></description>
<query-method>
<method-name>findByName</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[select object(o) from UserEntity o where o.userName = ?1]]></ejb-ql>
</query>
<query>
<description><![CDATA[findAllUsers]]></description>
<query-method>
<method-name>findAllUsers</method-name>
<method-params>
</method-params>
</query-method>
<ejb-ql><![CDATA[select object(o) from UserEntity o]]></ejb-ql>
</query>
</entity>
 
 
<entity >
<description><![CDATA[Description for CommitteeEntity]]></description>
<display-name>Name for CommitteeEntity</display-name>
<ejb-name>CommitteeEntity</ejb-name>
<home>net.iluviya.boardoftrustees.interfaces.CommitteeEntityHome</home>
<remote>net.iluviya.boardoftrustees.interfaces.CommitteeEntity</remote>
<local-home>net.iluviya.boardoftrustees.interfaces.CommitteeEntityLocalHome</local-home>
<local>net.iluviya.boardoftrustees.interfaces.CommitteeEntityLocal</local>
<ejb-class>net.iluviya.boardoftrustees.ejb.CommitteeEntityCMP</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>net.iluviya.boardoftrustees.interfaces.CommitteeEntityPK</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>CommitteeEntity</abstract-schema-name>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>committeeId</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>committeeName</field-name>
</cmp-field>
<query>
<description><![CDATA[findByName]]></description>
<query-method>
<method-name>findByName</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[ select object(o) from CommitteeEntity o where o.committeeName = ?1]]></ejb-ql>
</query>
<query>
<description><![CDATA[findAllCommittees]]></description>
<query-method>
<method-name>findAllCommittees</method-name>
<method-params>
</method-params>
</query-method>
<ejb-ql><![CDATA[select object(o) from CommitteeEntity o]]></ejb-ql>
</query>
</entity>
 
<entity >
<description><![CDATA[Description for CommitteeMemberEntity]]></description>
<display-name>Name for CommitteeMemberEntity</display-name>
<ejb-name>CommitteeMemberEntity</ejb-name>
<home>net.iluviya.boardoftrustees.interfaces.CommitteeMemberEntityHome</home>
<remote>net.iluviya.boardoftrustees.interfaces.CommitteeMemberEntity</remote>
<local-home>net.iluviya.boardoftrustees.interfaces.CommitteeMemberEntityLocalHome</local-home>
<local>net.iluviya.boardoftrustees.interfaces.CommitteeMemberEntityLocal</local>
<ejb-class>net.iluviya.boardoftrustees.ejb.CommitteeMemberEntityCMP</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>net.iluviya.boardoftrustees.interfaces.CommitteeMemberEntityPK</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>CommitteeMemberEntity</abstract-schema-name>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>committeeId</field-name>
</cmp-field>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>userId</field-name>
</cmp-field>
</entity>
 
 
The following excerpt is from my openejb-jar.xml:
 
<ejb-relation>
<ejb-relation-name>Committee-CommitteeMembers</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>Committee-has-many-CommitteeMembers</ejb-relationship-role-name>
<relationship-role-source>
<ejb-name>CommitteeEntity</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>committeeMembers</cmr-field-name>
</cmr-field>
<foreign-key-column-on-source/>
<role-mapping>
<cmr-field-mapping>
<key-column>CommitteeId</key-column>
<foreign-key-column>CommitteeId</foreign-key-column>
</cmr-field-mapping>
</role-mapping>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>CommitteeMember-belongs-to-Committee</ejb-relationship-role-name>
<relationship-role-source>
<ejb-name>CommitteeMemberEntity</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>committee</cmr-field-name>
</cmr-field>
<foreign-key-column-on-source />
<role-mapping>
<cmr-field-mapping>
<key-column>CommitteeId</key-column>
<foreign-key-column>CommitteeId</foreign-key-column>
</cmr-field-mapping>
</role-mapping>
</ejb-relationship-role>
</ejb-relation>
<ejb-relation >
<ejb-relation-name>User-CommitteeMembers</ejb-relation-name>
<ejb-relationship-role >
<ejb-relationship-role-name>User-has-many-CommitteeMemberships</ejb-relationship-role-name>
<relationship-role-source >
<ejb-name>UserEntity</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>committeeMemberships</cmr-field-name>
</cmr-field>
<foreign-key-column-on-source/>
<role-mapping>
<cmr-field-mapping>
<key-column>UserId</key-column>
<foreign-key-column>UserId</foreign-key-column>
</cmr-field-mapping>
</role-mapping>
</ejb-relationship-role>
<ejb-relationship-role >
<ejb-relationship-role-name>CommitteeMember-is-a-User</ejb-relationship-role-name>
<relationship-role-source >
<ejb-name>CommitteeMemberEntity</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>userEntity</cmr-field-name>
</cmr-field>
<foreign-key-column-on-source />
<role-mapping>
<cmr-field-mapping>
<key-column>UserId</key-column>
<foreign-key-column>UserId</foreign-key-column>
</cmr-field-mapping>
</role-mapping>
</ejb-relationship-role>

</ejb-relation>