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