Hi, I’m trying
to use Castor JDO with JBoss but having some problems with
transactions. My client
starts a transaction and tries to call session bean methods two times. Each of
them saves an object into the
db: userTran.begin(); bean=ServiceBroker.getBean(); try { bean.createObject(obj1); bean.createObject(obj2); userTran.commit(); } catch (Exception e) { userTran.rollback(); } When
stateful session bean is activated, its field _jdo is
initialized: public void setSessionContext(SessionContext
sc) { try { InitialContext ic = new
InitialContext(); _jdo = (DataObjects)
ic.lookup("java:comp/env/jdo/castor"); } catch (Exception e)
{ e.printStackTrace(System.out); } } Then, when
the createObject() from the client is called I do the
following: db = _jdo.getDatabase(); db.create(o); db.close(); Then I try
to commit the transaction in the client. The bean transaction attribute is
Mandatory and it must join the client transaction. The problem
is that when the exception is thrown in the second call in the bean and
therefore I try to rollback the transaction it doesn’t happen and the first
object is save in the db however I need to save both or
none. Can anyone
help me here? Thanks a
lot Alex
Ryltsov |