* @ejb.relation
* name="UserAssociatedWithRoles"
* role-name="UserBeanToRoleBean"
* target-ejb="Role"
At here add these lines:
* target-role-name="******"
* target-multiple="yes"
...
guo
--- [EMAIL PROTECTED] 的正文:> Hi all,
> i am experiencing problems with generating
> descriptors
> for Many to Many relationship.
>
> i have an UserBean (mapped to following table)
> (tbl_user)
>
> EMAIL
> PASSWORD
>
> i have a RoleBean (mapped to following table)
> (tbl_role)
>
> NAME
> DESCRIPTION
>
> in addition, for implementing this many to many, i
> have create a new
> table named (tbl_user_role) with following field
> EMAILFK
> NAMEFK
>
> emailfk and namefk are primary keys, plus i have
> added foreign keys
> that references tbl_user(email) and tbl_role(name)
>
> the relationship is Unidirectional, from the
> UserBean i can go to the Role
> but not ViceVersa.
>
> So i have written following method (in UserBean
> ONLY)
>
> /**
> * @return return the Role associated to this
> UserInfo
> * @ejb.interface-method
> * view-type="local"
> * @ejb.relation
> * name="UserAssociatedWithRoles"
> * role-name="UserBeanToRoleBean"
> * target-ejb="Role"
> * @weblogic.relation
> * join-table-name="tbl_user_role"
> * @weblogic.column-map
> * foreign-key-column="emailfk"
> * key-column="name"
> */
> public abstract Collection getRoles();
>
>
> I have put the target-ejb since the relationship is
> unidirectional
>
> , but
> when i generate the code the generated ejb-jar.xml
> is following
>
> <ejb-relation>
>
>
<ejb-relation-name>UserAssociatedWithRoles</ejb-relation-name>
>
> <ejb-relationship-role>
>
>
<ejb-relationship-role-name>UserBeanToRoleBean</ejb-relationship-role-name>
>
> <multiplicity>One</multiplicity>
> - <relationship-role-source>
> <ejb-name>User</ejb-name>
> </relationship-role-source>
> - <cmr-field>
> <cmr-field-name>roles</cmr-field-name>
>
>
<cmr-field-type>java.util.Collection</cmr-field-type>
>
> </cmr-field>
> </ejb-relationship-role>
> - <ejb-relationship-role>
> <multiplicity>Many</multiplicity>
> - <relationship-role-source>
> <ejb-name>Role</ejb-name>
> </relationship-role-source>
> </ejb-relationship-role>
> </ejb-relation>
>
> and the resulted relationship is One to Many..
> can anyone tell me what do i have to do in order to
> make it Many to Many?
> add a method also to RoleBean? but then how do i
> make it undirectional?
>
> hope someone can help me
>
> thanx in advance and regards
> marco
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> >
> [mailto:[EMAIL PROTECTED]
> Behalf Of ext
> > [EMAIL PROTECTED]
> > Sent: 12 November, 2003 10:09
> > To: [EMAIL PROTECTED]
> > Subject: Re: [Xdoclet-user] Working Examples of
> Bidirectional CMR on
> > JBoss 3.2.x?
> >
> >
> >
>
http://www.jboss.org/thread.jsp?forum=47&thread=41050&message=3810264
> > I tried it also and finally got it working, but I
> won't use
> > it anymore.
> > Too much hassle.
> > My "link table" also has other attributes. Instead
> I use two
> > 1:N relations.
> > regards,
> > Jeroen.
> >
> > > Rick,
> > >
> > > When I use CMS, the roles must be
> pre-configured in
> > > web.xml, I usually need not delete the roles in
> > > database as long as they are setup and If I do
> so, it
> > > will cause problem. There is no requirement for
> me
> > > that given a role, list all the users related.
> Using
> > > such a query will results an extremely large
> result
> > > set in an internet application.
> > > You can use bi-directional relationship between
> User
> > > and Role, nothing wrong about that if that makes
> life
> > > easier.
> > > From my understanding, ejb deploy descriptor
> can be
> > > categorized into 4 parts:
> > > entity declaration,
> > > relationship declaration;
> > >
> > > entity mapping declaration,
> > > relationship mapping declaration.
> > >
> > > The former should be in standrad dd while the
> later
> > > goes in vender specific dds.
> > > In my application, I have User and Role as
> entity
> > > bean. UserRole is the result of n-m relationship
> > > mapping between the two ebtity beans.
> > > As for cacade delete, it is just that JBossCMP
> > > cann't do it for you in n-m relationship.
> > > I met many limitations using CMR. I have to
> work
> > > around by manual coding. I guess that is not
> unusual.
> > >
> > > If your ejbdoclet task declaration in your
> build.xml
> > > is properly setup(including all the dependent
> class
> > > lib), another cause of not generating the dd may
> be
> > > the package name in the class file is not
> compatible
> > > with its location. Maybe you can have a check of
> both.
> > >
> > > Hope it helps,
> > >
> > > Guo
> > > --- "R. P. Ruiz" <[EMAIL PROTECTED]>
> 的正文:>
> > > Guo & all,
> > >>
> > >> Thanks for responding so quickly, i was
> beginning to
> > >> feel a bit adrift.
> > >>
> > >> Here's why i want to use what i understand is a
> a
> > >> bi-directional
> > >> relationship: just as i want to be able to
> retrieve
> > >> all roles that a
> > >> user has, i also want to retrieve all users who
> have
> > >> a role of type
> > >> 'appOneUser' for instance. As i understand it,
> i
> > >> can't currently do
> > >> this w/o declaring a cmr. This type of query
> will
> > >> prove invaluable once
>
=== message truncated ===
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user