Hi,

I am using the PersistenceBroker (OJB 1.0 rc5) and have some problems to store 2 
objects within a single transaction. The problem is, that I want to have the whole 
transaction comitted if and only if a calculation between these two store operations 
has been successfull, otherwise the first store operation will be rolled back.  
Consider the following code snippet:

try{
       pm = PersistenceBrokerFactory.defaultPersistenceBroker();

       pm.beginTransaction();
       pm.store(object1);
}
catch ...

followed by some calculations then retrieve the first object to get the id (which was 
set by OJB via autoincrement) ...

try{
      pm.getObjectId(object1);
}
catch ...

follwed by another operation and if succeeded then store object2 and finish the 
transaction:

try{
      pm.store(object2);
      pm.comitTransaction();
      pm.close();
}
catch...

I always get a TransactionNotInProgressException. How can I solve this problem?

thx,
Dirk

      






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to