toddcoulson wrote:
Basically, I need a group of root menu items to be made from Materials depending upon the course selected, then each of those materials maps out other sub menu items from other materials. So a material has a list of other materials (which also must all comply to the courseID given). This pattern continues until there are no more materials with parent items attached to them.
This is not a many-to-many relationship. This is some sort of hierarchical recursive one. And I'm afraid I don't know much about how to deal with it in Hibernate. These are always problematic to work through. The data structure is clear, but your code may have to run numerous queries to fetch the data, recursively adding each material encountered to some processing queue until the unprocessed portion of the queue is empty. It's not particularly hard to code this, but there are often performance penalties. If you can keep this data in long-term memory, or load the entire table quickly and easily when needed, it shouldn't be too bad. If not, watch out for those infinite loops!
toddcoulson wrote:
I found this:
http://tadtech.blogspot.com/2007/09/hib ... in_03.htmlwhich is close to what I need, but it does not seem to build out items to the same item - like Materials to Materials which is my case. Any help is appreciated.
This is not really like your case, at least as I understand it. This is a classic example of a many-to-many relationship. One person can have many different addresses. And one address can house many people. This is usually modeled in a database with an additional table that has person_id and address_id columns, in which a single entry means that a particular person is associated with a certain address. This Hibernate handles fine. But I don't think it applies to your problem.
Good luck,
-- Scott