-->
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.  [ 3 posts ] 
Author Message
 Post subject: Initializing Lazy Sets
PostPosted: Tue Apr 27, 2004 5:24 pm 
Newbie

Joined: Wed Oct 08, 2003 8:52 am
Posts: 10
Hi All,
Currently, I have an application that have it's own cache. I want to start some designing to move it to Hibernate and use EHCache instead of the custom one. Here is my current set up

The User object have Sets such as roles, loans, notes, and etc.

1. loans (lazy="true")
2. notes (lazy="true")

this way if they administrator is listing all the user, we don't want to load everything up.

Now from the user list, the administrator is selecting a specific user. Now I want to load the user and initialize the loans and notes before I close the session.

1. hibSession.load(User.class, key);
2. What can I use to inititialize loans and notes Set with one call? I know I can just do the good old getLoans() and getNotes() call but with if there were many of those. That is why the question above.

The application above are mostly load and view of items (5000+ objects) and users (5000+ objects). Does it save much if I put them in the cache permanently (no expire time) or just do the query each time? I would assume the earlier is pobably the way.


Regards,

JavaLamer


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 27, 2004 6:58 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
For 2: There is no builtin way. It should however not be difficult to write a helper class that iterates over all properties (use ClassMetadata) and calls Hibernate.initialize() on everyone.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 27, 2004 9:42 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Perhaps you should set batch-size


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.