Hello all,
 
I am having problems with OJB transactions. I am currently using OJB1.0.1 on 
WSAD 5.1.2 using JDK 1.3.1.
 
My settings and code are as follows:
 
useAutoCommit="0" 
ignoreAutoCommitExceptions="false"
 
PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl
ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl
 
And the code looks as follows(I am using WSAD 5.1.2):
 
javax.transaction.UserTransaction userTx = null;
try {
    InitialContext initCtx = new InitialContext();
    userTx = (UserTransaction)initCtx.lookup("java:comp/UserTransaction");
    userTx.begin();
    
    broker.store(objA);
    broker.store(objB);
    broker.deleteByQuery(someQuery);
    broker.store(objC);
    
    userTx.commit();
} catch(Exception e) {
    userTx.rollback();
}
 
But whenever I am calling broker.store(), I am getting the following warning on 
the console:
 
[org.apache.ojb.broker.core.PersistenceBrokerImpl] WARN: No running tx found, 
please only store in context of an PB-transaction, to avoid side-effects - e.g. 
when rollback of complex objects
 
Now, it appears to me that the broker.store() is not going through the 
transaction. Am I doing something wrong??
 
Also, a very strange thing happened today. I had a large amount of data to 
store and it was taking a long time and the transaction timed out after 120 
seconds. Is this possibly because the user transaction started and none of the 
broker store calls are going through it. BUT, the strangest thing I have found 
is if any error occurs, the store calls ARE rolling back, so they are part of 
SOME transaction. Also, where is the 120 seconds setting coming from? I thought 
transactions are not supposed to time out during activity!
 
This is getting very confusing. Can anyone throw some light on my situation? 
Any help is greatly appreciated. Thanks.
 
Regards,
-Vamsi

Reply via email to