Hi Dirk,

hmm, this shouldn't be a problem. Do you use any connection object from OJB while performing your test?
Do you use ConnectionFactoryManagedImpl in OJB.properties file as ConnectionFactoryClass?
Do you use DataSource?


regards,
Armin

Dirk Manske (Service Respond) wrote:
Hi Wally,

auto-commit is set to "2" = off. I still get an
org.apache.ojb.broker.TransactionNotInProgressException: ConnectionManager
is NOT in transaction. This exception is thrown after pm.commitTransaction()
is executed. However, if I comment this out, it runs well, both objects are
stored. I really got stucked on this. Any idea?

thx,
Dirk


-----Ursprüngliche Nachricht-----
Von: Gelhar, Wallace Joseph [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 30. Dezember 2003 05:07
An: OJB Users List
Betreff: RE: how can i do multiple operations in one transaction?


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]


--------------------------------------------------------------------- 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]



Reply via email to