Title: Message
Hello Richard,
 
I looked at the CClaim class which is giving the object modified exception. There is a java.sql.Timestamp field in it.
 
I had the same problem with my class when I have Timestamp field,  What I did was to just set dirty=ignore for that field as workaround.
 
This was sometime back, so I don't exactly remember, but the symptom was following --
 
I was not changing the time stamp field in anyway..yet..
The timestamp field in the database is NULL or '1970...' don't remember exactly, but Castor reads it as one thing and when comparing the value with database at time of commit treats database value differently.
 
Hope this helps,
Sandeep.
-----Original Message-----
From: Richard Grill [mailto:[EMAIL PROTECTED]
Sent: Friday, August 01, 2003 7:41 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] ObjectModifiedException problem ... Dancing with concurrency ?

Dear Werner,
 
thanks for your reply, my code is too complex I'm affraid, anyway I'm sending you some relevant parts of the code and the mapp.
 
 
Thanks,
Richard
 
 
----- Original Message -----
Sent: Friday, August 01, 2003 2:56 PM
Subject: Re: [castor-dev] ObjectModifiedException problem ... Dancing with concurrency ?

Richard,

would you mind posting your code ? Without this, it is going to be a bit difficult to see what's going on ? And maybe even attach your mapping file (relevant portions only, please) ?

Werner

--Original Message Text---
From: Richard Grill
Date: Fri, 1 Aug 2003 10:56:15 +0200

Hi Werner,

Many thanks for your answer, and thank you also for your answer to my previous question (DbLocked locking of child ).

I'm using CASTOR from whithin my beans - middle tier of web - JSP/Servlet application - using the jakarta-tomcat-4.0.3.

There was only one user connected to the Tomcat with only one http session during my test with ObjectModifiedException.
I've prepared very detailed log from my application about the execution of all CASTOR's transaction handling and load commands and here it is :

2003.08.01 10:47:20|5|Test User 1|10|listServlet::DoPostx() before db_ls = jdo.getDatabase();
2003.08.01 10:47:20|5|Test User 1|10|listServlet::DoPostx() after db_ls = jdo.getDatabase();

2003.08.01 10:47:20|5|Test User 1|10|listServlet::DoPostx() before db_ls.begin();
2003.08.01 10:47:20|5|Test User 1|10|listServlet::DoPostx() after db_ls.begin()

2003.08.01 10:47:21|5|Test User 1|10|CWorkList::RefreshMy() before db_wl = jdo.getDatabase();
2003.08.01 10:47:21|5|Test User 1|10|CWorkList::RefreshMy() after db_wl = jdo.getDatabase();

2003.08.01 10:47:21|5|Test User 1|10|CWorkList::RefreshMy() before db_wl.begin();
2003.08.01 10:47:21|5|Test User 1|10|CWorkList::RefreshMy() after db_wl.begin();

2003.08.01 10:47:21|5|Test User 1|10|CWorkList::RefreshMy() before objClaim_wl = (CClaim) db_wl.load(CClaim.class, new Integer(objClaim_wl.getID()), db_wl.ReadOnly );
2003.08.01 10:47:21|5|Test User 1|10|CWorkList::RefreshMy() after objClaim_wl = (CClaim) db_wl.load(CClaim.class, new Integer(objClaim_wl.getID()), db_wl.ReadOnly );

2003.08.01 10:47:21|5|Test User 1|10|CWorkList::RefreshMy() before db_wl.commit();
2003.08.01 10:47:21|5|Test User 1|10|CWorkList::RefreshMy() after db_wl.commit();

2003.08.01 10:47:21|5|Test User 1|10|CWorkList::RefreshMy() before db_wl.close();
2003.08.01 10:47:21|5|Test User 1|10|CWorkList::RefreshMy() after db_wl.close();

2003.08.01 10:47:24|5|Test User 1|10|listServlet::DoPostx() before db_ls.commit();
2003.08.01 10:47:24|5|Test User 1|10|listServlet::DoPostx() after db_ls.commit();

2003.08.01 10:47:24|5|Test User 1|10|listServlet::DoPostx() before db_ls.close();
2003.08.01 10:47:24|5|Test User 1|10|listServlet::DoPostx() after db_ls.close();

2003.08.01 10:47:25|5|Test User 1|10|ViewTask.jsp > before db_vt = jdo.getDatabase();
2003.08.01 10:47:25|5|Test User 1|10|ViewTask.jsp > after db_vt = jdo.getDatabase();

2003.08.01 10:47:25|5|Test User 1|10|ViewTask.jsp > before db_vt.begin();
2003.08.01 10:47:25|5|Test User 1|10|ViewTask.jsp > after db_vt.begin();

2003.08.01 10:47:25|5|Test User 1|10|ViewTask.jsp > before db_vt.commit();
2003.08.01 10:47:26|5|Test User 1|10|ViewTask.jsp > after db_vt.commit();

2003.08.01 10:47:26|5|Test User 1|10|ViewTask.jsp > before db_vt.close();
2003.08.01 10:47:26|5|Test User 1|10|ViewTask.jsp > after db_vt.close();

2003.08.01 10:47:27|5|Test User 1|10|StepExecServlet::doPostx() before db_se = jdo.getDatabase();
2003.08.01 10:47:27|5|Test User 1|10|StepExecServlet::doPostx() after db_se = jdo.getDatabase();

2003.08.01 10:47:27|5|Test User 1|10|StepExecServlet::doPostx() before db_se.begin();
2003.08.01 10:47:27|5|Test User 1|10|StepExecServlet::doPostx() after db_se.begin();

2003.08.01 10:47:27|5|Test User 1|10|StepExecServlet::doPostx() before objClaim = (CClaim) db_se.load(CClaim.class, new Integer(objClaim.getID()) );
2003.08.01 10:47:27|5|Test User 1|10|StepExecServlet::doPostx() after objClaim = (CClaim) db_se.load(CClaim.class, new Integer(objClaim.getID()) );

2003.08.01 10:47:27|5|Test User 1|10|StepExecServlet::doPostx() before db_se.commit();
2003.08.01 10:47:28|5|Test User 1|10|StepExecServlet::doPostx() after db_se.commit();

2003.08.01 10:47:28|5|Test User 1|10|StepExecServlet::doPostx() before db_se.close();
2003.08.01 10:47:28|5|Test User 1|10|StepExecServlet::doPostx() after db_se.close();

2003.08.01 10:47:28|5|Test User 1|10|listServlet::DoPostx() before db_ls = jdo.getDatabase();
2003.08.01 10:47:28|5|Test User 1|10|listServlet::DoPostx() after db_ls = jdo.getDatabase();

2003.08.01 10:47:28|5|Test User 1|10|listServlet::DoPostx() before db_ls.begin();
2003.08.01 10:47:28|5|Test User 1|10|listServlet::DoPostx() after db_ls.begin();

2003.08.01 10:47:28|5|Test User 1|10|CWorkList::RefreshMy() before db_wl = jdo.getDatabase();
2003.08.01 10:47:28|5|Test User 1|10|CWorkList::RefreshMy() after db_wl = jdo.getDatabase();

2003.08.01 10:47:28|5|Test User 1|10|CWorkList::RefreshMy() before db_wl.begin();
2003.08.01 10:47:28|5|Test User 1|10|CWorkList::RefreshMy() after db_wl.begin();

2003.08.01 10:47:28|5|Test User 1|10|CWorkList::RefreshMy() before objClaim_wl = (CClaim) db_wl.load(CClaim.class, new Integer(objClaim_wl.getID()), db_wl.ReadOnly );
2003.08.01 10:47:28|5|Test User 1|10|CWorkList::RefreshMy() after objClaim_wl = (CClaim) db_wl.load(CClaim.class, new Integer(objClaim_wl.getID()), db_wl.ReadOnly );

2003.08.01 10:47:28|5|Test User 1|10|CWorkList::RefreshMy() before db_wl.commit();
2003.08.01 10:47:28|5|Test User 1|10|CWorkList::RefreshMy() after db_wl.commit();

2003.08.01 10:47:28|5|Test User 1|10|CWorkList::RefreshMy() before db_wl.close();
2003.08.01 10:47:28|5|Test User 1|10|CWorkList::RefreshMy() after db_wl.close();

2003.08.01 10:47:28|5|Test User 1|10|listServlet::DoPostx() before db_ls.commit();
2003.08.01 10:47:28|5|Test User 1|10|listServlet::DoPostx() after db_ls.commit();

2003.08.01 10:47:28|5|Test User 1|10|listServlet::DoPostx() before db_ls.close();
2003.08.01 10:47:28|5|Test User 1|10|listServlet::DoPostx() after db_ls.close();

2003.08.01 10:47:29|5|Test User 1|10|ViewTask.jsp > before db_vt = jdo.getDatabase();
2003.08.01 10:47:29|5|Test User 1|10|ViewTask.jsp > after db_vt = jdo.getDatabase();

2003.08.01 10:47:29|5|Test User 1|10|ViewTask.jsp > before db_vt.begin();
2003.08.01 10:47:29|5|Test User 1|10|ViewTask.jsp > after db_vt.begin();

2003.08.01 10:47:29|5|Test User 1|10|ViewTask.jsp > before db_vt.commit();
2003.08.01 10:47:29|5|Test User 1|10|ViewTask.jsp > after db_vt.commit();

2003.08.01 10:47:29|5|Test User 1|10|ViewTask.jsp > before db_vt.close();
2003.08.01 10:47:29|5|Test User 1|10|ViewTask.jsp > after db_vt.close();

2003.08.01 10:47:31|5|Test User 1|10|StepExecServlet::doPostx() before db_se = jdo.getDatabase();
2003.08.01 10:47:31|5|Test User 1|10|StepExecServlet::doPostx() after db_se = jdo.getDatabase();

2003.08.01 10:47:31|5|Test User 1|10|StepExecServlet::doPostx() before db_se.begin();
2003.08.01 10:47:31|5|Test User 1|10|StepExecServlet::doPostx() after db_se.begin();

2003.08.01 10:47:31|5|Test User 1|10|StepExecServlet::doPostx() before objClaim = (CClaim) db_se.load(CClaim.class, new Integer(objClaim.getID()) );
2003.08.01 10:47:31|5|Test User 1|10|StepExecServlet::doPostx() after objClaim = (CClaim) db_se.load(CClaim.class, new Integer(objClaim.getID()) );

2003.08.01 10:47:32|5|Test User 1|10|StepExecServlet::doPostx() before db_se.commit();
2003.08.01 10:47:32|5|Test User 1|1|StepExecServlet::doPostx() Transaction aborted: Object of type abcwf.CClaim with identity 162 has been modified by a concurrent transaction (cache entry is different from database row)
2003.08.01 10:47:32|5|Test User 1|1
org.exolab.castor.jdo.ObjectModifiedException: Transaction aborted: Object of type abcwf.CClaim with identity 162 has been modified by a concurrent transaction (cache entry is different from database row)
at org.exolab.castor.jdo.engine.SQLEngine.store(SQLEngine.java:882)
at org.exolab.castor.persist.ClassMolder.store(ClassMolder.java:1616)
at org.exolab.castor.persist.LockEngine.store(LockEngine.java:758)
at org.exolab.castor.persist.TransactionContext.prepare(TransactionContext.java:1540)
at org.exolab.castor.jdo.engine.DatabaseImpl.commit(DatabaseImpl.java:528)
at wfengine.StepExecServlet.doPostx(StepExecServlet.java:287)
at wfengine.StepExecServlet.doPost(StepExecServlet.java:28)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
at java.lang.Thread.run(Thread.java:484)
2003.08.01 10:47:32|5|Test User 1|10|StepExecServlet::doPostx() before db_se.close();
2003.08.01 10:47:32|5|Test User 1|10|StepExecServlet::doPostx() after db_se.close();

Thank you very much Werner.

Regards,
Richard






----- Original Message -----
From: Werner Guttmann
To: [EMAIL PROTECTED]
Sent: Thursday, July 31, 2003 7:40 PM
Subject: Re: [castor-dev] ObjectModifiedException problem ... Dancing with concurrency ?


Richard,

can you elaborate a bit about the environment in which you are trying to use Castor ? Are you using Castor in stand-alone mode or as part of e.g.. a web app or an EJB deployment unit. If latter is the case, multiple (concurrent) threads might try to access one and the same object per definition, hence leading to such an exception.

The same might be the case if you are allowing modification of your data outside of Castor, e.g. via another application.

Without a short description, it will be very hard to assist you.

Regards
Werner

I am sure you are aware that --Original Message Text---
From: Richard Grill
Date: Thu, 31 Jul 2003 17:08:16 +0200



Hello,

I've problem with

ObjectModifiedException: Transaction aborted: Object of type xxx.yyyy with identity zzz has been modified by a concurrent ....

I'm not able to find problem with incorrect transaction handling in my code.

As I've read in [castor-dev] Dancing with concurrency http://hypermail.linklord.com/castor-dev.old/2002/Aug/0696.html

> Yes, in fact, Castor officially requires bi-directional
> relationships (although this is not rigorously enforced
> everywhere). Yes, they're a pain, but hopefully one day they
> won't be required.

I've 4 questions:

1. Could using of uni-directional object relationships lead to:

ObjectModifiedException: Transaction aborted: Object of type xxx.yyyy with identity zzz has been modified by a concurrent transaction (cache entry is different from database row).

2. Except this case I've no problem while using uni-directional relationships in whole project . Should I use bi-directional relationships for all master-detail (parent-child) object couples ?

3. Where or on which situations and how is bi-directional relationship rigorously enforced ?

4. A very stupid question -

" ... if an Order object contains a reference to a LineItem object, the LineItem object must contain a reference to the Order object ..."

does reference mean that class/object Order must have object property of class LineItem with get and set methodes ... and vice versa ... + same changes in the mapping file.



Thanks,

Richard



BTW:

Temporarily I've solved this problem by refreshing object cache via db.DbLocked load:

db.begin();

objYYYY = (yyyy) db.load(yyyy.class, objYYYY.getID(), db.DbLocked)

db.commit();











**************************Disclaimer************************************

Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' and 'confidential' and intended for use only by the individual
 or entity to which it is addressed. You are notified that any use, copying 
or dissemination of the information contained in the E-MAIL in any manner 
whatsoever is strictly prohibited.

***************************************************************************

Reply via email to