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
|