[hibernate-dev] Session opening

Max Rydahl Andersen max.andersen at redhat.com
Mon Apr 4 07:34:13 EDT 2011


Sorry - didn't get the mail thread in proper order (damn VPN!)

>From reading the whole thread I guess the answer is:

session.sessionWithOptions().connection().openSession()
or even
session.sessionWithOptions().transactionContext().openSession()

I'm still a bit fuzzy about where the lifecycle boundaries are - when does this
second session stop working - I assume when the first session is closed or is
it more complex than that ?

In any case, is there a method on a session to know if it is still valid or if its operations
will fail?

/max


>> Any questions or concerns?
> 
> Which of these best fits AuditLogInterceptor pattern ? i.e. where you want the same connection
> as a session but do not wish to "pollute" the session with entities/state concerning the auditlog entries ?
> 
> None of them seem to allow for that as far as I can see ?
> 
> They either use different session or have a limited lifecycle not permitting keeping a second session 
> around for lookup/state ?
> 
> Am I missing something ?
> 
> /max
> http://about.me/maxandersen
> 
> 
> 
> 
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev

/max
http://about.me/maxandersen







More information about the hibernate-dev mailing list