I have created an Entity EJB that maps to a table with a compound PK
(both columns are NOT NULL). One of the columns of the PK, "COMMUNITYID_FK" is a FK to another table representing the many side of a 1-* relationship.
From sql file used to create table: ----------------------------------- create table MEMBERS ( MEMBERID VARCHAR2(64) not null, COMMUNITYID_FK VARCHAR2(64) not null, ISCREATOR NUMBER(38) not null, DT_JOINED DATE not null, DT_LASTVISITED DATE not null, BGCOLOR VARCHAR2(24), FGCOLOR VARCHAR2(24), MESSAGEDISPLAY NUMBER(38), SUBSCRIBE NUMBER(38), NEWSLETTER NUMBER(38), GROUPEMAIL NUMBER(38), constraint PK_MEMBERS primary key (MEMBERID,COMMUNITYID_FK), constraint FK_MEMBERS_COMMUNITY foreign key (COMMUNITYID_FK) references COMMUNITY (COMMUNITYID) on delete cascade );
Using XDoclet, I can generate what appears to be the proper source and deployment descriptors...all of which deploy to JBoss-4alpha with no problem.
From my jbosscmp-jdbc.xml file: ------------------------------- ... <entity> <ejb-name>Members</ejb-name> <datasource>java:/OracleDS</datasource> <datasource-mapping>Oracle9i</datasource-mapping> <create-table>false</create-table> <table-name>SYSTEM.MEMBERS</table-name>
<cmp-field> <field-name>memberId</field-name> <column-name>MEMBERID</column-name>
</cmp-field> <cmp-field> <field-name>communityIdFk</field-name> <column-name>COMMUNITYID_FK</column-name>
</cmp-field> <cmp-field> <field-name>isCreator</field-name> <column-name>ISCREATOR</column-name>
</cmp-field> <cmp-field> <field-name>dateJoined</field-name> <column-name>DT_JOINED</column-name>
</cmp-field> <cmp-field> <field-name>dateLastVisited</field-name> <column-name>DT_LASTVISITED</column-name>
</cmp-field> <cmp-field> <field-name>subscribe</field-name> <column-name>SUBSCRIBE</column-name>
</cmp-field> <cmp-field> <field-name>newsletter</field-name> <column-name>NEWSLETTER</column-name>
</cmp-field> <cmp-field> <field-name>groupEmail</field-name> <column-name>GROUPEMAIL</column-name>
</cmp-field>
<!-- merge point: jbosscmp-jdbc-load-{0}.xml -->
</entity> ...
...
<ejb-relation> <ejb-relation-name>COMMUNITY-MEMBERS</ejb-relation-name> <foreign-key-mapping/>
<ejb-relationship-role>
<ejb-relationship-role-name>MEMBERS-has-COMMUNITY</ejb-relationship-role-name> <fk-constraint>true</fk-constraint> <key-fields/>
</ejb-relationship-role> <ejb-relationship-role>
<ejb-relationship-role-name>COMMUNITY-has-MEMBERS</ejb-relationship-role-name> <key-fields> <key-field> <field-name>communityId</field-name> <column-name>COMMUNITYID_FK</column-name> </key-field> </key-fields>
</ejb-relationship-role> </ejb-relation> ...
As you can see, the column "COMMUNITYID_FK" is the FK for the relationship, as well as a persistent field...both CMP and CMR.
The problem comes in when I try to create an instance of the EJB from a client app. A SQLException is thrown, indicating you "can not insert NULL" into the column.
The thread:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg03782.html
led me to believe this was fixed in 4-alpha. Does anyone have it working yet? Any advice...this driving me crazy.
Thanks, -Billy
-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: Dedicated Hosting for just $79/mo with 500 GB of bandwidth! No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user