Hi,
I have a question on using hibernate in both BMT and CMT at the same time.
By now I have a CMT stateles session bean. In it I have methods which I want to be executed in a transaction. So CMT works fine for that.
But in this session bean I have a getObejct() methd and a updateObject() method.
When I want to update an object I read this object within one transaction but update it in an other. This can lead to lost update issues.
Now I want use a BMT UserTransaction to put this both methods in one transaction.
Since my methods have the CMT transaction-type="Required" they will be called by the UserTransaction and won't start new transactions.
It looks like this:
Code:
UserTransaction tx = ... ;
tx.begin();
service.getObject();
//change some attributes
service.updateObject();
tx.commit();
As I use CMT I just use sessionFactory.currentSession(); in the CMT methods
Can still use this, if I do it the way above?
Do I need to confiruge something special for this? I'm using JBoss.
Best regard,
Jakob