hi all,
        i have written an application that uses castor JDO for inserting, retrieving
and updating objects in a database (mysql db).
My app consists of a J2ME phone that communicates with a servlet via ksoap. the 
servlet (struts, mvc)
takes care of retrieving objects, inserting them and updating them in the 
database(using castor JDO).
communication between servlet and J2ME is ksoap.
I have no problem in inserting new objects in the database, and neither in retrieving
them.
I however got following exception when trying to update and existing object in the 
database.

1:20:12,542 ERROR [STDERR] No transaction in progress for the current thread
1:20:12,542 ERROR [STDERR] org.exolab.castor.jdo.TransactionNotInProgressException: No 
transaction in progress for the c
rrent thread
1:20:12,662 ERROR [STDERR]     at 
org.exolab.castor.jdo.engine.DatabaseImpl.getTransaction(DatabaseImpl.java:495)
1:20:12,662 ERROR [STDERR]     at 
org.exolab.castor.jdo.engine.DatabaseImpl.update(DatabaseImpl.java:376)
1:20:12,662 ERROR [STDERR]     at 
com.tgmm.castor.CastorPersistenceManagerImpl.updateAgency(Unknown Source)
1:20:12,662 ERROR [STDERR]     at 
com.tgmm.castor.CastorPersistenceManagerImpl.updateObject(Unknown Source)

The code that i have written for persisting objects is as follows

try {
    db = _jdo.getDatabase();
    db.update(agency);
} ....

i have tried also to write db.begin() and db.commit() before the update, but that 
hasn't worked
either..


where agency is the object that i am going to update in the database.
Now, worth of mention is that the retrieval and the update are not part of the same 
transaction, since
object is retrieved, and its data is passed via SOAP to the J2ME client.
the J2ME client updates the data, and a new SOAP message is sent to the servlet, that 
contains
the data that needs to be updated.

Once i have read in castor docs that if the retrieval and update are not part of the 
same transaction, i have
to write a setTimeStamp() and getTimeStamp method. i have done them, but the problem 
is that, due to limitations of
J2ME classes, i am using two different classes (that obey to the same interface) for 
my Agency object, and the timestamp
is used ONLY at the moment of updating the object..

can anyone help me in finding out the problem?

thanx and regards
        marco

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to