You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Alessandro Colantoni <ac...@brujulatelecom.com> on 2004/08/10 17:15:55 UTC

RV: org.apache.ojb.broker.OptimisticLockException: Object has been modified by someone else

 
 
-----Mensaje original-----
De: Alessandro Colantoni [mailto:acolantoni@brujulatelecom.com] 
Enviado el: martes, 10 de agosto de 2004 17:12
Para: 'ojb-user-subscribe@db.apache.org'
Asunto: org.apache.ojb.broker.OptimisticLockException: Object has been
modified by someone else
 
Hi,
I'm trying to use ObjectCacheOSCacheImpl just for a table.
I specified just in the class descriptor where to get the implementation
of the cache and I followed all the steps in the HOW-TO document.
I left the Empty implementation of the cache in the ojb.properties.
Than I have a method findByPrimaryKey that search a record of my table
CASO
 
broker = ServiceLocator.getInstance().findBroker();
criteria.addEqualTo("IDCASO", new Integer(primaryKey));
Query query=QueryFactory.newQuery(CASOVO.class, criteria);
cASOVO = (CASOVO) broker.getObjectByQuery(query);
 
Ojb look for datas in the cache because it doesn't see changes done
manually in the dB
 
Than I have a method to update the table
 
CASOVO cASOVO = (CASOVO) insertRecord;
broker = ServiceLocator.getInstance().findBroker();
broker.beginTransaction();
broker.store(cASOVO);
broker.commitTransaction();
 
In the line of the store I get the error
org.apache.ojb.broker.OptimisticLockException: Object has been modified
by someone else
 
 
What's wrong?