HI Werner,
    thanx a lot for the reply.
First of all, i forgot to mention that i am using Castor in a J2EE environment (if that makes
any difference.....), so i am using CastorMBean to instantiate a Database object.
-----Original Message-----> 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.
 
I have looked at examples, and i did not saw any transaction when updating
 
 
 
>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 ? 
if i put  begin/commit i got following exception
 
TDERR] org.exolab.castor.jdo.LockNotGrantedException: persist.writeLockTimeout
TDERR]     at org.exolab.castor.persist.ObjectLock.acquireUpdateLock(ObjectLock.java:509)
TDERR]     at org.exolab.castor.persist.LockEngine$TypeInfo.acquire(LockEngine.java:1081)
TDERR]     at org.exolab.castor.persist.LockEngine$TypeInfo.access$300(LockEngine.java:963)
TDERR]     at org.exolab.castor.persist.LockEngine.update(LockEngine.java:627)
TDERR]     at org.exolab.castor.persist.TransactionContext.markUpdate(TransactionContext.java:1000)
TDERR]     at org.exolab.castor.persist.TransactionContext.update(TransactionContext.java:1074)
TDERR]     at org.exolab.castor.jdo.engine.DatabaseImpl.update(DatabaseImpl.java:381)
 
 
 

>
>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 ?
 
well, maybe i have explained wrongly :-(   fact is that some of the packages that i use
for the Agency Castor object are not present in the JM2E...but fact is that i thought that the
timestamp was needed ONLY when updating..........i did not have to carry it over the SOAP message..
and maybe that is the problem.. i'll try to pass the timestamp from beginning to end of
communication and let u know if i still encounter problems..
 
 
thanx and regards
    marco
 
 
 
 

>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