Hello Armin,

I tried this alread. This will give me an:

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(Serve
rOjbDAO.java:230)


The Operation on the database crashes.

Other suggestions?

Julia.
-----Ursprüngliche Nachricht-----
Von: Armin Waibel [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 9. Juli 2003 15:38
An: OJB Users List
Betreff: Re: transaction in JBoss with MySQL Datasource


Hi,

try to use JTA UserTransaction or container-managed tx
and do not use ODMG tx-declaration.

UserTransaction utx = ...
utx.begin()
> db.deletePersistent(toBeDeleted); /* here it crashes */
utx.commit()

HTH
regards,
Armin

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 09, 2003 3:25 PM
Subject: transaction in JBoss with MySQL Datasource


> 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(S
erve
> 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(S
erve
> 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]
>
>
>



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