[hibernate-dev] Session opening

Max Rydahl Andersen max.andersen at redhat.com
Wed Apr 6 04:47:52 EDT 2011


>>> Like I said, I do not think that is enough as I think that if you get the
>>> connection, you also need the "transaction context" holding that connection.
>>> "transacvtion context" here is the TransactionCoordinator.
>>> 
>>> session.sessionWithOptions().transactionContext().openSession()
>> 
>> Okey and the transactionContext actually continues to lives on even though the source session
>> is closed, correct ?
> No, that is not correct.  And the same is true of the corollary in the "old code" using its Connection as well.  In the old code, if you did:
> factory.openSession( someExistingSession.connection() )
> the new session is screwed once 'someExistingSession' is closed.

hmm - not sure that was always the case...but anyway it is for sure a shaky assumption so all good :)

>> Trying to get my head around some of the old special case assumptions ;)
> Well my argument is always that assumptions are bad :)  Make it a contract

Agreed ;)

/max
http://about.me/maxandersen







More information about the hibernate-dev mailing list