Hello!

I' using JBoss 3.0.6, OJB rc3 and a MySQL Database, which is configured as a
Datasource for Local Transaction.

I'm trying to delete an object but I'm having some problems with the
transaction. I have tried several things with the following results:

---------------------
1. Use only of org.odmg.Transaction:

Transaction tx = odmg.currentTransaction();
if ( !tx.isOpen())
        tx.begin();
db.deletePersistent(toBeDeleted); /* here it crashes */
tx.commit();

Result: 
org.odmg.TransactionNotInProgressException: No external transaction found
        at org.apache.ojb.odmg.JTATxManager.registerTx(Unknown Source)
        at org.apache.ojb.odmg.TransactionImpl.begin(Unknown Source)
        at org.apache.ojb.odmg.OJBJ2EE_2.beginInternTransaction(Unknown
Source)
        at org.apache.ojb.odmg.OJBJ2EE_2.currentTransaction(Unknown Source)
        at
de.arvatosystems.monitoring.integration.dao.server.ServerOjbDAO.delete(Serve
rOjbDAO.java:227)

-------------------
2. Use only of UserTranscation:
UserTransaction userTx = (UserTransaction)
context.lookup("java:/comp/UserTransaction");
userTx.begin();
db.deletePersistent(toBeDeleted); /* here it crashes */
userTx.commit();    

Result:
org.odmg.TransactionNotInProgressException: No transaction in progress,
cannot delete persistent
        at org.apache.ojb.odmg.DatabaseImpl.deletePersistent(Unknown Source)
        at
de.arvatosystems.monitoring.integration.dao.server.ServerOjbDAO.delete
(ServerOjbDAO.java:230)

---------------------
3. Use of both (Transaction and UserTransaction combined):

UserTransaction userTx = (UserTransaction)
context.lookup("java:/comp/UserTransaction");
userTx.begin();
Transaction tx = odmg.currentTransaction();
if ( !tx.isOpen())
        tx.begin();
db.deletePersistent(toBeDeleted);
tx.commit(); /* here it crashes */
userTx.commit();  

Result:
java.lang.UnsupportedOperationException: Not supported operation
        at org.apache.ojb.odmg.NarrowTransaction.commit(Unknown Source)
        at
de.arvatosystems.monitoring.integration.dao.server.ServerOjbDAO.delete(Serve
rOjbDAO.java:232)

---------------------
4. like 3 but I uncomment tx.commit(). No exceptions but the object is not
deleted. No SQL statement is generated by OJB.


I know it is a lot to read but maybe somebody can take some time to read my
code.
Where is my problem and which transactions should I use? Or is the
configuration of my Datasource wrong?

Thanks, Julia.

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

Reply via email to