Hi Dirk, PB transactions are database transactions (as opposed to the object level transactions provided by ODMG, OTM, and JDO). Check your database connection descriptor to make sure you have autocommit turned off. I suspect that the JDBC connection is autocommiting the transaction for you on the store operation.
Wally -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 6:27 PM To: [EMAIL PROTECTED] Subject: how can i do multiple operations in one transaction? 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
