[hibernate-dev] Session opening

Steve Ebersole steve at hibernate.org
Tue Apr 5 12:32:34 EDT 2011


On 04/05/2011 11:23 AM, Max Rydahl Andersen wrote:
>> 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.


> 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


-- 
Steve Ebersole <steve at hibernate.org>
http://hibernate.org



More information about the hibernate-dev mailing list