Hello Armin,

this is really costing my nerves!!

Same result as before! It is passing by without an exception and with no
result! And as I sad, before I try to delete I'm looking up the object in
the database (with findByPrimaryKey) to be sure I delete an existing object:

ServerVO toBeDeleted = findByPrimaryKey(integrationVO.getEntryId(), new
Locale(integrationVO.getLocale()));
Transaction tx = odmg.newTransaction();
tx.begin();
odmg.currentTransaction();
db.deletePersistent(toBeDeleted);
tx.commit();

Can it be because of the structure of my Objects/Repository? ServerVO has
some simple attributes and a reference to ModulesVO (1:1). ModulesVO holds a
List (1:n) of Objects extending the class ModuleVO.

But I would expect to see at least anything like an SQL or at least a
warning, if I try to delete an Object that has references on other Objects.
Or not? I attach an ER-Diagramm of my structure to get an understanding of
what I'm talking about. Because I fear it's a little bit confusing. But I'm
not sure if it could have to do something with it.

Julia.

-----Ursprüngliche Nachricht-----
Von: Armin Waibel [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 10. Juli 2003 10:05
An: OJB Users List
Betreff: Re: transaction in JBoss with MySQL Datasource



----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 10, 2003 9:53 AM
Subject: AW: transaction in JBoss with MySQL Datasource


Hello Armin,

sorry to tell, but this didn't work, too. Now I get this:

Transaction tx = odmg.newTransaction(); /* crashes here */
######
sorry, forget to say do directly use
Implementation odmg = OJB.getInstance()
instead lookup via JNDI.

Armin

tx.begin();
db.deletePersistent(toBeDeleted);
tx.commit()

java.lang.UnsupportedOperationException: Not supported in managed
environment
        at org.apache.ojb.odmg.OJBJ2EE_2.newTransaction(Unknown Source)
        at
de.arvatosystems.monitoring.integration.dao.server.ServerOjbDAO.delete(S
erve
rOjbDAO.java:228)

The object is in the database because I before I try to delete it, I
look up
in the database.

Julia.

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


> The result is, that I get no exception but also no result!
hmm, very strange! Does the 'toBeDeteted' object really
exists in the database?

OK, another attempt let OJB do the
whole tx demarcation.
Use
OJBTxManagerClass=org.apache.ojb.odmg.LocalTxManager
ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFacto
ryPooledImpl

Transaction tx = odmg.newTransaction();
tx.begin();
db.deletePersistent(toBeDeleted);
tx.commit()

Does this works for you?

regards,
Armin

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 10, 2003 9:09 AM
Subject: AW: transaction in JBoss with MySQL Datasource


The result is, that I get no exception but also no result! It simply
passes
by with no SQL being executed. I integrated P6Spy for debugging of the
SQL
and it also shows no statement being mad (no delete or so).

Anything else to try? It seems to me, I've tried already all
combinations.

Julia.

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


> I tried this alread. This will give me an:
sorry, overlooked that!

> org.odmg.TransactionNotInProgressException: No external transaction
> found
Seems OJB is not associated with JTA transaction.
Can you try

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

What's the result now?

regards,
Armin


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


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






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






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