-->
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.  [ 2 posts ] 
Author Message
 Post subject: outer join fetching load() vs find()
PostPosted: Fri Jun 18, 2004 12:31 pm 
Newbie

Joined: Thu Apr 01, 2004 3:36 pm
Posts: 13
Location: New York
Dear hibernaters,

I have a table (USER_EVENT) with many-to-one relationships to some dictionaries. I want to load all records from this table along with the dictionary values. The straightforward:

List eventList = session.find("from UserEvent");

does not use outer joins and does one query for each dictionary value.

On the other hand,

session.load(UserEvent.class, new Long(900));

does use outer joins which confirms that the configuration is fine.

Is this the expected behaviour? What should I do to enable outer joins when fetching a list?

Thanks,

Bogdan Calmac.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 18, 2004 12:43 pm 
Newbie

Joined: Thu Apr 01, 2004 3:36 pm
Posts: 13
Location: New York
OK, after some more invesigation it seems that

List eventList = session.find("from UserEvent ue left join ue.topic");

does the job.

Is there any way to have hibernate detect the relationships as when calling load()? Something like loadAll()?

I would prefer to keep the relationships in the hibernate configuration, it makes the code easier to maintain.

Thanks,

Bogdan Calmac


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

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.