Hi Shiva,

a ObjectModifiedException is thrown by Castor if the object in cache differs from the objects representation in the database. There is a various number of reasons that can cause that:

- another application changes the values in the database
- you have mapped the same table with 2 mappings and change the values through both of them - your database does change values when storing (e.g. convert null to empty String, clip String to column length)

Castor is only able to recognize that changes when you try to modify the object the next time after one of the above situation happend.

Regards
Ralf


Shiva P. Kodityala schrieb:

I am trying to modify one of the columns of an obtained row.
Problem seems to be something to do with nulls.

Here is the code:

for(int i=0; i<numberOfSelectedUsers;i++)

{

database = connectionPool.getJDOConnection();

database.begin();

String oqlString = "select p from test.tables.User p where userid=$1";

oql = database.getOQLQuery(oqlString);

oql.bind( selectedUserIds[i]);

results = oql.execute();

User user = null;

while (results.hasMore()) {

user = (User) results.next();

}

user.setActivationstatus(toStatus);

database.commit();

database.close();

database = null;

}

Here is error. It is not  happening always.. I don't know why.

following fields have been changed [actual/expected value]: 
(test.tables.User).address1: [/null](test.tables.User).address2: 
[/null](test.tables.User).address3: [null/null](test.tables.User).city: 
[null/null](test.tables.User).state: [/null](test.tables.User).country: 
[null/null](test.tables.User).ZIP: [/null]
[11/29/05 22:25:06:609 PST] 7e116486 DatabaseImpl  E 
org.exolab.castor.jdo.engine.DatabaseImpl  TRAS0014I: The following exception 
was logged org.exolab.castor.jdo.ObjectModifiedException: Transaction aborted: 
Object of type test.tables.User with identity hk has been modified by a 
concurrent transaction (cache entry is different from database row). The 
following fields have been changed [actual/expected value]: 
(test.tables.User).address1: [/null](test.tables.User).address2: 
[/null](test.tables.User).address3: [null/null](test.tables.User).city: 
[null/null](test.tables.User).state: [/null](test.tables.User).country: 
[null/null](test.tables.User).ZIP: [/null]
at org.exolab.castor.jdo.engine.SQLEngine.store(SQLEngine.java:1013)
at org.exolab.castor.persist.ClassMolder.store(ClassMolder.java:834)
at org.exolab.castor.persist.LockEngine.store(LockEngine.java:779)
at 
org.castor.persist.TransactionContext.prepareForCreate(TransactionContext..java:1654)
at org.castor.persist.TransactionContext.prepare(TransactionContext.java:1618)
at org.exolab.castor.jdo.engine.DatabaseImpl.commit(DatabaseImpl.java:521)
at test.actions.ChangeStatusAction.changeStatus(ChangeStatusAction.java:226)
at test.actions.ChangeStatusAction.active(ChangeStatusAction.java:120)
at test.actions.ChangeStatusAction.execute(ChangeStatusAction.java:47)
at 
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at 
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at 
com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at 
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at 
com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at 
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at 
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at 
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
at 
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
at 
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at 
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at 
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at 
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at 
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at 
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)
..
                                org.exolab.castor.jdo.ObjectModifiedException: 
Transaction aborted: Object of type test.tables.User with identity hk has been 
modified by a concurrent transaction (cache entry is different from database 
row). The following fields have been changed [actual/expected value]: 
(test.tables.User).address1: [/null](test.tables.User).address2: 
[/null](test.tables.User).address3: [null/null](test.tables.User).city: 
[null/null](test.tables.User).state: [/null](test.tables.User).country: 
[null/null](test.tables.User).ZIP: [/null]
at org.exolab.castor.jdo.engine.SQLEngine.store(SQLEngine.java:1013)
at org.exolab.castor.persist.ClassMolder.store(ClassMolder.java:834)
at org.exolab.castor.persist.LockEngine.store(LockEngine.java:779)
at 
org.castor.persist.TransactionContext.prepareForCreate(TransactionContext..java:1654)
at org.castor.persist.TransactionContext.prepare(TransactionContext.java:1618)
at org.exolab.castor.jdo.engine.DatabaseImpl.commit(DatabaseImpl.java:521)
at test.actions.ChangeStatusAction.changeStatus(ChangeStatusAction.java:226)
at test.actions.ChangeStatusAction.active(ChangeStatusAction.java:120)
at test.actions.ChangeStatusAction.execute(ChangeStatusAction.java:47)
at 
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at 
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at 
com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at 
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at 
com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at 
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at 
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at 
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
at 
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
at 
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at 
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at 
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at 
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at 
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at 
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)

[11/29/05 22:25:06:656 PST] 7e116486 SystemErr     R 
org.exolab.castor.jdo.ObjectModifiedException: Transaction aborted: Object of 
type test.tables.User with identity hk has been modified by a concurrent 
transaction (cache entry is different from database row). The following fields 
have been changed [actual/expected value]: (test.tables.User).address1: 
[/null](test.tables.User).address2: [/null](test.tables.User).address3: 
[null/null](test.tables.User).city: [null/null](test.tables.User).state: 
[/null](test.tables.User).country: [null/null](test.tables.User).ZIP: [/null]
[11/29/05 22:25:06:656 PST] 7e116486 SystemErr     R  at 
org.exolab.castor.jdo.engine.SQLEngine.store(SQLEngine.java:1013)
[11/29/05 22:25:06:656 PST] 7e116486 SystemErr     R  at 
org.exolab.castor.persist.ClassMolder.store(ClassMolder.java:834)
[11/29/05 22:25:06:656 PST] 7e116486 SystemErr     R  at 
org.exolab.castor.persist.LockEngine.store(LockEngine.java:779)
[11/29/05 22:25:06:656 PST] 7e116486 SystemErr     R  at 
org.castor.persist.TransactionContext.prepareForCreate(TransactionContext..java:1654)
[11/29/05 22:25:06:656 PST] 7e116486 SystemErr     R  at 
org.castor.persist.TransactionContext.prepare(TransactionContext.java:1618)
[11/29/05 22:25:06:656 PST] 7e116486 SystemErr     R  at 
org.exolab.castor.jdo.engine.DatabaseImpl.commit(DatabaseImpl.java:521)
[11/29/05 22:25:06:656 PST] 7e116486 SystemErr     R  at 
test.actions.ChangeStatusAction.changeStatus(ChangeStatusAction.java:226)
[11/29/05 22:25:06:656 PST] 7e116486 SystemErr     R  at 
test.actions.ChangeStatusAction.active(ChangeStatusAction.java:120)
[11/29/05 22:25:06:656 PST] 7e116486 SystemErr     R  at 
test.actions.ChangeStatusAction.execute(ChangeStatusAction.java:47)
[11/29/05 22:25:06:656 PST] 7e116486 SystemErr     R  at 
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
[11/29/05 22:25:06:656 PST] 7e116486 SystemErr     R  at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
[11/29/05 22:25:06:656 PST] 7e116486 SystemErr     R  at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
[11/29/05 22:25:06:656 PST] 7e116486 SystemErr     R  at 
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
[11/29/05 22:25:06:656 PST] 7e116486 SystemErr     R  at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
[11/29/05 22:25:06:656 PST] 7e116486 SystemErr     R  at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
[11/29/05 22:25:06:656 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
[11/29/05 22:25:06:672 PST] 7e116486 SystemErr     R  at 
com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)








------------------------------------------------------------------------

-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------



-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to