wood burning stoves*
The moose likes EJB and other Java EE Technologies and the fly likes EJB Relation Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB Relation Question" Watch "EJB Relation Question" New topic
Author

EJB Relation Question

Sam Wang
Ranch Hand

Joined: Jul 17, 2001
Posts: 95
I have two many to many cmp entity beans.
a userbean,a rolebean.
There are three tables in database:usertable,
roletable,userrolemaptable.
The PK of userrolemaptable is two fk:userid,
roleid.
Now i want to update the userrolemaptable.
How can i do it?I haven't the userrolemapbean.


SCJP(2001)
Jim Baiter
Ranch Hand

Joined: Jan 05, 2001
Posts: 532
I would check your vendors documentation for either many-to-many unidirectional or bidirectional relationship. The EJB spec has some material on it in chapter 10.5 but vendor docs will probably be more useful.
Sam Wang
Ranch Hand

Joined: Jul 17, 2001
Posts: 95
Last night,i had finished my work and i understood
my problem.Also thanks for your reply.
Caroline Iux
Ranch Hand

Joined: May 14, 2001
Posts: 103
Stub Wang, can you post your solution here too?
Sam Wang
Ranch Hand

Joined: Jul 17, 2001
Posts: 95
Caroline Iux,if u use cmp,it's very convenience
to deal with m:n relations.
To tell u the truth,I'm not familiar with deploy
description.I finish this work under the help of
jbuilder's ejbmodule.From ejb-jar.xml:
<ejb-relation>
<ejb-relation-name>userEntity-roleEntity</ejb-relation-name>
<ejb-relationship-role>
<description>userEntity</description>
<ejb-relationship-role-name>UserEntityRelationshipRole</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<description>userEntity</description>
<ejb-name>UserEntity</ejb-name>
</relationship-role-source>
<cmr-field>
<description>roleEntity</description>
<cmr-field-name>roleEntity</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<description>roleEntity</description>
<ejb-relationship-role-name>RoleEntityRelationshipRole</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<description>roleEntity</description>
<ejb-name>RoleEntity</ejb-name>
</relationship-role-source>
<cmr-field>
<description>userEntity</description>
<cmr-field-name>userEntity</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>
</relationships>
From weblogic-cmp-rdbms-jar.xml:
<weblogic-rdbms-relation>
<relation-name>userEntity-roleEntity</relation-name>
<table-name>BZUSERROLEMAPTB</table-name>
<weblogic-relationship-role>
<relationship-role-name>UserEntityRelationshipRole</relationship-role-name>
<column-map>
<foreign-key-column>USERID</foreign-key-column>
<key-column>USERID</key-column>
</column-map>
</weblogic-relationship-role>
<weblogic-relationship-role>
<relationship-role-name>RoleEntityRelationshipRole</relationship-role-name>
<column-map>
<foreign-key-column>ROLEID</foreign-key-column>
<key-column>ROLEID</key-column>
</column-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>
May this help u.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB Relation Question
 
Similar Threads
Question on inner classes
How often the listeners as well as filters are used in applications by companies??
50 Gmail Invites
Big question on relationships
hibernate many-to-many