First Thanks a lot Alexey for your fast answer !

I'd like to know if anybody has done some performance study about Castor,
what are the recommendations...

Thanks again for any help !

Christophe

-----Original Message-----
From: Alexey A. Efimov [mailto:[EMAIL PROTECTED]]
Sent: mardi 22 janvier 2002 11:58
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] TimeStamp...while updating


You can use db.update only for object from another transaction. 
Example:
...
// First transaction (get the object)
db.begin
o = db.load(Object.class, id);
db.commit();

// Here we change object
o.setXX(...);

// Second transaction (update the object)
db.begin();
db.update(o);
db.commit();

This called in Castor as "Long Transactions". In restriction of class to
support this feature of Castor your object must implement interface
Timestample. See examples fo Castor ans docs.
My example:
public class CastorItem implements TimeStampable {
  /** Timestamp  */
  protected long timeStamp;

  public long jdoGetTimeStamp() {
    return timeStamp;
  }

  public void jdoSetTimeStamp(long timeStamp) {
    this.timeStamp = timeStamp;
  }

  // Here other setters and getters
}
-----Original Message-----
From: Vu, Christophe [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 22, 2002 1:23 PM
To: [EMAIL PROTECTED]
Subject: [castor-dev] TimeStamp...while updating
Importance: High


I begin with Castor and I have some trouble with the Update (Select,
Create and Remove are fine).

While doing my update I have this error:

JDO UPDATE java.lang.IllegalArgumentException: A master object that
involves in a long transaction must be a TimeStampable!


My code:

<%@ page import="org.exolab.castor.jdo.*" %>
<%@ page import="cka.*" %>
JDO UPDATE
<%
JDO      jdo;
Database db;
// Define the JDO object
jdo = new JDO();
jdo.setDatabaseName( "cka" );
jdo.setConfiguration( "database.xml" );
jdo.setClassLoader( getClass().getClassLoader() );

Integer idobj=new Integer(1001);
// Obtain a new database
db = jdo.getDatabase();
try
{

// Create the Product object
for (int i=1001;i<=1007;i++) {
// Begin a transaction
db.begin();
        Alumno alres = new Alumno();
        alres = (Alumno)db.load(Alumno.class,idobj);
// Commit the transaction, close database
db.commit();
db.begin();
        alres.setNombre("prueba"+i+" updated");
        db.update(alres);
// Commit the transaction, close database
db.commit();
        
};
db.close();
}
catch(Exception e)
{
  if (db.isActive())    db.rollback();
  out.println(e + "<br>");
}           

%>                     

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to