Hibernate 3.
Transactions managed by JBoss.
One approch to support long transactions in Hibernate 3 is the Extended session. A single Session instance are used for the whole conversation. The Session is disconnected from any underlying JDBC connection when waiting for user interaction. Beginning a new database transaction on an old session obtains a new connection and resumes the session.
Usually the relationship between Session and Transaction is one-to-one because Session is not threadsafe.
My question is:
If two different clients requests a EJB SessionBean on JBoss server to update an object previous loaded in same Session, two different transaction will start and both will try to update the object on same session. This scenario could happen, right?
So how can I ensure that have to no thread safe problems when use the Extend session approach?
Thanks,
Pedro Cardoso
|