-->
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.  [ 1 post ] 
Author Message
 Post subject: What's the difference between openSession and getCurrentSess
PostPosted: Mon Mar 05, 2007 5:51 am 
Newbie

Joined: Sun Mar 04, 2007 5:19 am
Posts: 8
Hey All:
It might be a stupid question , but really i can't fully understand the difference between openSession(), and getCurrentSession, I read hibernate api documentation , but no use, I mean what is written is in the api is good , but not clear enough, I tried using both of them
e.g.
when I use getCurrentSession() it retrieves the current session, which i understand, but how is it controlled?, I don't know .

when i use openSession, it opens a new connection and opens a new session on it, what i don't understand is that this session doesn't need a transaction to be started , which is not the case of getCurrentSession() , why is that? whats the difference between both of them, and which should I use?

another thing I don't understand , why can't I use the session without starting a transaction, I mean if the relation is one-to-one why doesn't hibernate just opens the transaction for me

p.s.I mean that openSession Doesn't throw an exception if no transaction is used.

how can I update a an object in the DB when I use openSession() without opening a trasaction?

I'm using hibernate 3.2.2.ga from withen RSA


Thanks
Hany


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.