-->
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: newbie on hibernate question.
PostPosted: Tue Jan 04, 2011 8:50 pm 
Newbie

Joined: Thu Dec 01, 2005 5:58 pm
Posts: 10
i just start to learn hibernate. i open a transaction every time i need to access the database and close the transaction after database returns the value. if works great when i retrieve everything. however, when i change to lazy loading, everything breaks. what can i do to solve the issue and what's the best practice on transaction open and close. i heard people mention spring is great dealing with transaction. is this true?

thanks


Top
 Profile  
 
 Post subject: Re: newbie on hibernate question.
PostPosted: Wed Jan 05, 2011 10:24 am 
Newbie

Joined: Wed Jan 05, 2011 9:58 am
Posts: 1
Hello.

Everything breaks is a bit vague expression, maybe you should post a exception stack here. :)

Also, it is most likely that after retrieving data you have closed the session, and because lazy loading is set, it didn't load properties that contain other domain objects.

Anyhow, this behavior is normal, you should read up a bit on using lazy loading, and either make session last longer (look up OSIV) or get what you need in your query while session is open.

As for Spring, yes it is great, and works well with Hibernate, especially with transactions (look up @Transactional). Look up some of those Spring/Hibernate tutorials out there.


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.