-->
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: User one session object for number of queries
PostPosted: Tue Sep 22, 2009 6:07 am 
Newbie

Joined: Tue Sep 22, 2009 6:00 am
Posts: 3
hi
I am using one session object for all my method. i pass one session in all method.
I face problem o inserting raw in my table when i used one session.
and when i used differnce session for one query the nit work what is solution of that


Top
 Profile  
 
 Post subject: Re: User one session object for number of queries
PostPosted: Tue Sep 22, 2009 8:04 pm 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Rather than passing in the session, you could just use a static HibernateUtil method and call getCurrentSession().

This shouldn't be a problem. The only challenge is demarcating the transaction boundaries, which will control when a unit of work is complete.

_________________
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  
 
 Post subject: Re: User one session object for number of queries
PostPosted: Tue Sep 22, 2009 11:40 pm 
Newbie

Joined: Tue Sep 22, 2009 6:00 am
Posts: 3
Cameron McKenzie wrote:
Rather than passing in the session, you could just use a static HibernateUtil method and call getCurrentSession().

This shouldn't be a problem. The only challenge is demarcating the transaction boundaries, which will control when a unit of work is complete.

bb


Top
 Profile  
 
 Post subject: Re: User one session object for number of queries
PostPosted: Tue Sep 22, 2009 11:49 pm 
Newbie

Joined: Tue Sep 22, 2009 6:00 am
Posts: 3
Cameron McKenzie wrote:
Rather than passing in the session, you could just use a static HibernateUtil method and call getCurrentSession().

This shouldn't be a problem. The only challenge is demarcating the transaction boundaries, which will control when a unit of work is complete.




Thank you for reply

Here i have one query for select and inside that method i call insert method
it is possible
when i do then first query data lose when i call second query


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.