-->
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: load a collection of a Proxy
PostPosted: Fri May 19, 2006 8:55 am 
Regular
Regular

Joined: Tue Oct 14, 2003 11:11 pm
Posts: 62
Location: Brasil/Curitiba
Hi all,

Let's say I have a User Proxy...

User user = session.load(...)

if the user is a proxy, can I load its Groups without initialize the User?

ex: Collection groups = user.getGroups();

When I do this, the User is also loaded. Both User and Group is a proxy, and the "getUsers" is a lazy collection.

thanks,
Ricardo

_________________
Ricardo Lecheta


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 19, 2006 1:31 pm 
Senior
Senior

Joined: Tue Mar 09, 2004 2:38 pm
Posts: 141
Location: Lowell, MA USA
If the Groups to User relationship is defined as lazy and you executed the following query:

Code:
from Group as g where g.user.id  = :userid


The user instance should not be initialized. It will be initilized once you call a method on the assocaited User instance. If you're after a Group, don't execute a query for a User, go after the Group. If you load the User to get the Group you will load the user data.

Try it out an see what happens. It's the only way to know for sure :)

Ryan-

P. S. Don't forget to rate

_________________
Ryan J. McDonough
http://damnhandy.com

Please remember to rate!


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.