Hi,
I am gating org.exolab.castor.jdo.ObjectModifiedException: Timestamp mismatched! exception while updating object.
The cache-type cache="none" in the mapping file.
I am not using long transaction.(dirty="ignore")
The AutoStore property of the db object is set to true. (db.setAutoStore(true) )
Note: The exception occurs only when I update a typical object. For all other type objects there is no such error.
Here is the part of the mapping file and part of the code.
<class name="MAGE.QuantitationType" extends="MAGE.Identifiable" identity="id" key-generator="SEQUENCE" >
<cache-type cache="none"/>
<map-to table="TT_QuantitationType"/>
<field name="id" type="big-decimal">
<sql name="ID" type="numeric"/>
</field>
<field direct="true" name="isBackground" type="string">
<sql name="isBackground" type="char" dirty="ignore"/>
</field>
<field direct="true" name="channel" type="big-decimal">
<sql name="channel_ID" type="numeric" dirty="ignore"/>
</field>
<field direct="true" name="dataType" type="MAGE.OntologyEntry">
<sql name="dataType_ID" dirty="ignore"/>
</field>
<field direct="true" name="scale" type="MAGE.OntologyEntry">
<sql name="scale_ID" dirty="ignore"/>
</field>
</class>
synchronized boolean rebuildObject(HttpServletRequest request)
{
try{
DBThread DB_Thread = new DBThread(new DBPool());
try{
DB_Thread.start();
System.out.println("Starting the Castor engine ..");
while(! DB_Thread.isFinish()){
System.out.println("wait...");
this.wait(10);
}
}
catch(Exception e){
e.printStackTrace();
return false;
}
Vector objectStack= (Vector)session.getAttribute("object_stack");
Description description=null;
String value=null;
for(int i=objectStack.size()-1; i>=0; i--)
{
Object object=objectStack.elementAt(i);
String className=((object.getClass().toString()).substring(object.getClass().toString().indexOf(".",0)+1,object.getClass().toString().length())).trim();
Field publicFields[] = object.getClass( ).getFields( );
for(int j=0;j<publicFields.length;j++)
{
Field f=publicFields[j];
if(f.getName().equals("roleName") || f.getName().equals("parentClassList") ) continue;
value= request.getParameter((i+1)+":"+className+":"+f.getName());
if(value!=null){
if(f.getType().toString().endsWith("String")) {
if(value.length()>4000) continue;
f.set(object,value);
}
if(f.getType().toString().endsWith("Integer")){
f.set(object, new Integer(Integer.parseInt(value)));
}
if(f.getType().toString().endsWith("Long")){
f.set(object, new Long(Long.parseLong(value)));
}
if(f.getType().toString().endsWith("Double")) {
f.set(object, new Double(Double.parseDouble(value)));
}
if(f.getType().toString().endsWith("Float")){
f.set(object, new Float(Float.parseFloat(value)));
}
}
}
if(object instanceof QuantitationType){
value= request.getParameter("QuantitationType:description");
if(!( value==null || value.equals(""))){
description=new Description();
description.setText(value);
DB_Thread.getDb().begin();
DB_Thread.getDb().create(description);
DB_Thread.getDb().commit();
((QuantitationType)object).addDescriptions(description);
}
}
DB_Thread.getDb().begin();
DB_Thread.getDb().update(object); // Fails here for QuantitationType Objects.
DB_Thread.getDb().commit();
this.wait(200);
}
DB_Thread.submitDb();
session.removeAttribute("object_stack");
}
catch(Exception e){
e.printStackTrace();
return false;
}
return true;
}
may I get some help regarding this please?
Regards,
Avalovin.
Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
