Marco,

please see inline.

Werner

On Fri, 24 Oct 2003 21:28:28 +0300, [EMAIL PROTECTED] wrote:

>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

This exception indicates that there is not transaction in progress. Which is what I'd be expecting as you are NOT
associating a transaction with your current thread. Below code fragement should really read:

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

Database.begin()/commit(), when used in stand-alone mode, are responsible for transaction demarcation, i.e. starting
a transaction and committing naything related to this very transaction.

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

Well, at least you should be seeing a differnet exception. Would you mind sharing with us the exception you are
seeing ?

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

I think that's where your real problem is. For Castor to work, I'd consider such a scenario to be invalid. Can you
explain what the limitation is you are encountering, as I am not really familiar with J2ME ?


>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