tags:

views:

25

answers:

1

Hello

I have two tables (folder and document) which have a many to many relationship with a join table in between, this join table then also has another one to many relationship with a third table (document_title).

I want to be able to fetch a document_title from a document, what is the correct way to model this in hibernate?

The object model needs to be a Document that contains a DocumentTitle instance.

Thanks

A: 

I'm afraid what you're trying to do does not fit nicely into into OO world. I'd introduce thrid entity class as in-between. This third class can contain any attributes you like. So insted of many-to-many you would have two one-to-many relationships (or one-to-many and many-to-one).

mgamer