-->
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.  [ 4 posts ] 
Author Message
 Post subject: lazy AND eager loading
PostPosted: Sat Jul 16, 2005 3:12 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
I have two applications connected to the same DB. For the first, data mostly goes in (think data entry). For the second, data comes out (think reporting). The first application is finished, and all POJO's amd HBMs used for persistence are in a seperate jar. If both apps use this jar, they must both have the same eager/lazy configuration. I want the data entry application to be totally lazy, and the reporting app to be totally eager. How do I get around this?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 16, 2005 3:28 pm 
Newbie

Joined: Tue Jul 05, 2005 11:47 pm
Posts: 15
Location: Argentina
Perhaps using "entity-name" and having two mappings coexisting together?


Top
 Profile  
 
 Post subject: Re: lazy AND eager loading
PostPosted: Sat Jul 16, 2005 3:37 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
You can define all the mappings as lazy and use the Criteria API, specifically the criteria.setFetchMode("alias", FetchMode.JOIN) and specific application methods to change this at runtime.


Top
 Profile  
 
 Post subject: Modify at runtime
PostPosted: Mon Jul 18, 2005 10:17 pm 
Regular
Regular

Joined: Wed May 11, 2005 11:57 pm
Posts: 80
You can also override the configuration programatically at run time, like this:

Code:
Configuration config = new Configuration().configure( configFileUrl );
((Collection)config.getClassMapping(Instructor.class).getProperty("courses").getValue()).setLazy( true );


This will be passed into the SessionFactory and will control the behavior for the application, as if it had been hard-coded into the mapping file. Although I haven't done it, you could probably do some looping code to do this en masse for the whole configuration.

--Jesse


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