A bag semantic means potential duplicates in the collection.
If you look at a resultset containing for example A -> Bs -> Cs you'll see that 
you cannot determine whether an element is a dupe in Bs or in Cs when you load 
those 2 collections through the same SQL resultset.

There is no theorical solution for this issue, but it can happen in several 
situations:
 - multiple bags loading in a single HQL query with "fetch"
 - multiple bags collections set to EAGER in the static metadata (annotations), 
that requires it to be loaded in one resultset

This problem does not happen for set or list semantic collections (note that a 
java.util.List can have bag semantic, refer to the annotations documentation 
for more info).

The other generic issue with loading 2 collections in one resultset is that it 
returns way too much information and this information has to be deduplicate by 
hibernate in memory (too much DB work, too much network work, too much Java 
work). So usually, loading 2 collections in the same query is a bad choice.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3922830#3922830

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3922830


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to