-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Multiple Collections
PostPosted: Tue Mar 07, 2006 6:31 pm 
Newbie

Joined: Tue Mar 07, 2006 6:07 pm
Posts: 1
Hi,

Apologies in advance if this is a dumb question but I've been having a problem with hibernate at work that I'm unable to work out. First off a general question...

Is hibernate able to support join fetching of multiple collections so as all collections are initialised within a single selection statement. For example

A has child collections B and C

In my mind the following HQL should instantiate object A with its collections fully initialised but it doesn't seem to

from A a left join fetch a.B b left join fetch A.C c

The generated SQL seems to get all necessary data, a list of A's is created and every A has its collection B initialised but a seperate select is then run to get collection C for every A. Some possible problems that might be causing the problem..

I also have a where condition that makes reference to b and c, so the HQL now becomes - from A a left join fetch a.B b left join fetch A.C c where b.value = x and c.value = y. This is an unfortunate necessity due to mapping to a badly formed legacy DB

Secondly, B and C are actually the same object type and are defined in the same mapping under different mapping names which map to different tables in the DB, A contains seperate collection properties for the two rather than trying to splice them all into a single collection. Again this is due to badly designed tables and legacy data which I'm not responsible for nor have the power to modify.

If either of these issues could be causing my problem, is there a way around them so that I can do the whole retreival using a single select?

Many thanks in advance


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.