Announcement Announcement Module
Collapse
No announcement yet.
Best practice for many-to-many hibernate relationships Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Best practice for many-to-many hibernate relationships

    In current project there are a lot of many-to-many relationships via a link(join) table. Not sure if these should be or not but I'm working with it for now. The thing is I'm not quite sure what the best practice is so far all the link tables I've set the associations one-to-many lazy to false. However to get to the link table from an object I'll use a join in a hibernate query. This is to avoid massive performance problems that happened with setting to many associations to false with hibernate eager loading domino effect. With our many-to-one associations we are using left join fetches in queries to load them up. This seems to perform the best with less verbose queries in small amount of performance testing I've done. Not really sure if there is a best practice for all the different associations types with spring/hibernate integration. What is the fastest way? We can't use OpenSessionInView pattern as web tier will probably be on a different machine in next iteration.

  • #2
    Is it possible to see an example of the problem you are having and the hbm files for the mapping? I'm not quite sure what you mean when you talk about retrieving the join table, isn't this a detail of the association rather than an entity in it's own right?
    Last edited by karldmoore; Aug 30th, 2007, 06:30 AM.

    Comment

    Working...
    X