Hi Bob Ok then, Yes. :-)
http://www.hibernate.org/hib_docs/annotations/reference/en/html_single/ I've got the same scenario in my app. Example Request model: @Entity public class Request { private List<PersonRequest> personRequests; ...... @OneToMany(mappedBy="request") @OrderBy("date") public List<PersonRequest> getPersonRequests () { return personRequests; } ..... } Example Person model: @Entity public class Person { private List<PersonRequest> personRequests; ...... @OneToMany(mappedBy="person") @OrderBy("date") public List<PersonRequest> getPersonRequests () { return personRequests; } ..... } Example PersonRequest model: @Entity public class PersonRequest: private Person person; private Request request; ..... @ManyToOne @JoinColumn(name="person_id") public Person getPerson(){ return person; } @ManyToOne @JoinColumn(name="request_id") public Request getRequest(){ return request; } ....... } You may want to add details about cascading and the like. You'll obviously need to put annotations on your getId method's so hibernate know to use the id fields as primary keys. Just add in the other fields such as description as normal. Hope this helps. Cheers Aled -----Original Message----- From: syg6 [mailto:[EMAIL PROTECTED] Sent: 09 July 2007 12:18 To: [email protected] Subject: [appfuse-user] many-to-many with attribute ... again Hello all. I had this problem about a year ago and just couldn't get Hibernate and XDoclet to play nice. Basically I have this: Request id description Person id name PersonRequest idPerson idRequest date And I would like to know how to do with Annotations. The last time I wound up hand-hacking the hibernate mapping files and creating two intermediate 'composite' classes -- let's call them PersonRequest and PersonRequestPK -- and having to do all of the DAO by hand. Is there any way to do this auto-magically with Annotations? Please say yes ... Cheers, Bob -- View this message in context: http://www.nabble.com/many-to-many-with-attribute-...-again-tf4048626s2369.h tml#a11499869 Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
