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: Lazy Initialization exception
PostPosted: Fri Jan 22, 2010 3:39 am 
Newbie

Joined: Wed Jan 20, 2010 8:36 am
Posts: 3
how to set fetchmode type lazy=false by using java. i want property name for this?

forexample for the below property name is "hibernate.dialect".

setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect").


Top
 Profile  
 
 Post subject: Re: Lazy Initialization exception
PostPosted: Fri Jan 22, 2010 11:09 am 
Newbie

Joined: Fri Jan 22, 2010 11:04 am
Posts: 1
Im not an expert but I believe this is impossible.

Fetch mode is configured for each association inside HBM XML (or inside your class when using annotations)
and cannot be changed at runtime.


Top
 Profile  
 
 Post subject: Re: Lazy Initialization exception
PostPosted: Fri Jan 22, 2010 11:40 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Well, if your goal is to dynamically change if a collection is loaded lazily or not, well, I don't know any way of doing it. You can just create a couple of methods. Mark the association as lazy, and then have an eagerFetch method that just calls the getter for the list, which will force a loading of the association, essentially making it eagar when used.

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


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.