May I go back in time and reopen an old discussion?
> > Anyway, the syntax looks ugly to me, what about this syntax:
> > @ejb:relation name="Customer_Orders" target-ejb="ejb/Order"
> > multiplicity="One|Many"
> > And we can make it smart: if type=Collection -> multiplicity=Many,
> > otherwise One.
> >
>
> target-ejb is only required for unidircetional relationships
>
> I like the part of the multiplicity being automatic but it would still
> have to be there for unidirection relationships (target-multiple)
>
> On second throught that is tough for 1 to many because the roles are
> reversed. The many goes on the side that has 1 defined and the one
goes
> no the side that has the collection. You would have to be able to look
> at the other side of the relation to determine multiplicity. You would
> need both isA and isNotA code
>
> public booelan isRelationACollection() {
> if(curRelation.left == getCurrentClass())
> // check type of curRelation.rightMethod ,
> Collection,Set
> else
> // check type of curRelation.leftMethod
> }
Let's summarize it:
- If unidirectional (meaning a RelationHolder with left/leftMethod=null
or right/rightMethod=null)-> look at the target-ejb (target-ejb is
mandatory)
- if leftMethod.returnType=Set|Collection -> multiplicity for
target-ejb=many
- else -> multiplicity for target-ejb=One
- If bidirectional ->
- If leftMethod.returnType=Set|Collection -> multiplicity for
right=many
- Else -> multiplicity for right=one
Right? Seems ok to me.
Ara.
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel