Armin,
        Thanks for the quick reply . If I issue odmg.currentTransaction.abort() it 
appears that it rollsback my
changes . However , I am using p6spy and I see no "Rollback" being issued , should 
this be the case ? I am getting 
this stack trace after I use the odmg.currentTransaction.abort() . For whatever reason 
whenever I throw and EJBException
it does not roll back my changes back . I am using pb queries with odmg ... could this 
be causing me trouble ?

Thanks 

com.evermind.server.rmi.OrionRemoteException: Transaction was rolled back: Error
 in transaction: org.apache.ojb.broker.OJBRuntimeException: beforeCompletion fai
led in J2EETransactionImpl: Could not prepareCommit on closed tx
    
.............

               Nested exception is:
org.odmg.TransactionNotInProgressException: Could not prepareCommit on closed tx

        at org.apache.ojb.odmg.TransactionImpl.prepareForCommit(Unknown Source)
        at org.apache.ojb.odmg.J2EETransactionImpl.beforeCompletion(Unknown Sour
ce)
        at com.evermind.server.ApplicationServerTransaction.callSynchronizationB
eforeCompletion(ApplicationServerTransaction.java:1306)
        at com.evermind.server.ApplicationServerTransaction.beforeCompletion(App
licationServerTransaction.java:1209)
        at com.evermind.server.ApplicationServerTransaction.rollback(Application
ServerTransaction.java:527)
        at com.evermind.server.ApplicationServerTransaction.end(ApplicationServe
rTransaction.java:962)


-----Original Message-----
From: Armin Waibel [mailto:[EMAIL PROTECTED]]
Sent: November 29, 2002 7:22 PM
To: OJB Users List
Subject: Re: ODMG Session Bean oc4j


Hi Serge,

when call tx.lock(....) the objects will be collected within OJB,
there was no Database call, till the tx was commited by the container.
If you throw an EJBException or do abort all collected objects
will be discarded. So there shouldn't be any problems.
There are serveral rollback test cases all work fine.
When using a stateful session bean that keeps the modified
object, the modifications on the object will not be rolled back.
Maybe I don't understand the problem, maybe you could send a test
case to demonstrate the problem.


regards,
Armin


----- Original Message -----
From: "Boulay, Serge" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 29, 2002 10:55 PM
Subject: ODMG Session Bean oc4j


I am using odmg session bean example packaged with the source
distribution . It works well but I have one question .
When I throw and EJBException , or even tx.currentTransaction.abort()
only the last statement is aborted . I need an all or nothing principal
to work
for me .

The code is something like this

Transaction tx = odmg.currentTransaction();

....

// Save new object to database
tx.lock(objectToInsert, Transaction.WRITE);

// Perform an update
tx.lock(objectToUpdate, Transaction.UPGRADE);
object.setNextId(objectToInsert.getId());

throw new EJBException() -> or abort()




This code only rolls back the update and not the insert . I need it to
rollback both .
Any solutions would help .

Thanks

Serge



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


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

Reply via email to