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.


Reply With Quote