Emmanuel, Composition would be my preferred approach. I agree that the flat representation of XDoclet is less intuitive.
Cheers David. ----- Original Message ----- From: "Emmanuel Bernard" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, May 01, 2004 7:03 PM Subject: [Hibernate] Annotated collections > I'm working on collection annotations right now, and I don't like the > way it goes. > Since now I managed to annotate using composition for dependent annotation > @Id ( > @Generator( > @Param[] > ) > ) > And I strongly believe it's the best way to do. > > But for collections, this is more complex. > There should be something like > > @Map ( > @Index(), > @OneToMany() > ) > The problem is that Index can be CompositeIndex, IndexManyToMany etc > And OneToMany can be Element, ManyToMany etc and each of these > annotations structure are different. > > 2 solutions so far: > - Declare all kind of indexes inside Map and let the user set 1 of > these (other will have a default 'not used' value) > - Use the XDoclet way and put Map, Index etc flatten in the property. > > Remember that Annotation cannot be inherited and annotations does not > support some kind of (Index|CompositeIndex) like DTD does. > > The first one is a bit ugly but keep the composition way to do, and is > in my opinion much more readable when writing a metadata annotation for > a class. Of course a user could set 2 index or 2 elements in the same > Annotation, this should e checked at runtime. > The second one is ugly too. I've always found flatten XDoclet way too > complex: people never know which one to put together. And it does not > prevent the 2 indexes in the same annotated element issue. > Unfortunatly, due to Annotation flaws, neither can be ckecked at compile > time (at least I've not found how). But it'll be much simplier for me to > ckeck that at compile time in the first solution. > > I plan to go the the composition way. Any comment, vetoe? > > -- > Emmanuel Bernard > [EMAIL PROTECTED] > http://www.hibernate.org > > > > ------------------------------------------------------- > This SF.Net email is sponsored by Sleepycat Software > Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to > deliver higher performing products faster, at low TCO. > http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3 > _______________________________________________ > hibernate-devel mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/hibernate-devel ------------------------------------------------------- This SF.Net email is sponsored by Sleepycat Software Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO. http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3 _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel