> On Thu, 2003-07-17 at 13:27, Jean-philippe VIGNIEL wrote:
> > Hi everybody
> >
> > I have to manage a n:1 relation ship between two entities, is it
> > possible to generate the suitable ejb-jar by using the xdoclet
> > ejb.relation tag?
> > I've succeeded to specify a one to one relation but the only way i
> > found to have a n to 1 relation was to set by hand the source
> > <multiplicity> tag to Many.
> > I hope i'm not alone to need such a relation.
>
> For the case where you have Bean 1 having many Bean 2's, try this in
> Bean 1 for the interface method that returns a Collection
>
> @ejb.relation name="Bean1-Bean2"
> role-name="Bean1-has-many-Bean2"
> target-ejb="Bean2"
> target-role-name="Bean2-belongs-to-Bean1"
> target-cascade-delete="yes"
>
> If you want the accessor on Bean2 then it would be something like this
> in the interface method that returns an object
>
> @ejb.relation name="Bean1-Bean2"
> role-name="Bean2-belongs-to-Bean1"
> cascade-delete="yes"
> target-ejb="Bean1"
> target-role-name="Bean1-has-many-Bean2"
> target-multiple="true"
Hi,
If you are defining the relationship on both entities, creating a bidirectional
relation, aren't the attributes "target-cascade-delete", "target-role-name",
"target-multiple" and "target-ejb" unnecessary? Reading the XDoclet
documentation,
http://xdoclet.sourceforge.net/tags/[EMAIL PROTECTED](0..1), those
attributes are tagged as "Should *only* occur if the relation is
unidirectional". If you define both sides of the relationship, XDoclet is smart
enough to find out the values for those attributes, so you don't need them. At
least my application works without them :).
My 2ec,
D.
--
This message was sent using Sake Mail, a web-based email tool from
Endymion Corporation. http://www.endymion.com/products/sake
On Thu, 2003-07-17 at 13:27, Jean-philippe VIGNIEL wrote:
> Hi everybody
>
> I have to manage a n:1 relation ship between two entities, is it
> possible to generate the suitable ejb-jar by using the xdoclet
> ejb.relation tag?
> I've succeeded to specify a one to one relation but the only way i
> found to have a n to 1 relation was to set by hand the source
> <multiplicity> tag to Many.
> I hope i'm not alone to need such a relation.
For the case where you have Bean 1 having many Bean 2's, try this in
Bean 1 for the interface method that returns a Collection
@ejb.relation name="Bean1-Bean2"
role-name="Bean1-has-many-Bean2"
target-ejb="Bean2"
target-role-name="Bean2-belongs-to-Bean1"
target-cascade-delete="yes"
If you want the accessor on Bean2 then it would be something like this
in the interface method that returns an object
@ejb.relation name="Bean1-Bean2"
role-name="Bean2-belongs-to-Bean1"
cascade-delete="yes"
target-ejb="Bean1"
target-role-name="Bean1-has-many-Bean2"
target-multiple="true"
--
Andy
-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user