Hello everybody,

Seems like the class attribute "depends" doesn't work w/ long transaction.

code snippet (derived from the JDO example of Castor)
in mapping.xml
...
  <class name="net.uniopt.jdo.example1.ProductDetail" identity="id"
    depends="net.uniopt.jdo.example1.Product">
...
  </class>
...

in Main.java
public void run(PrintWriter writer) throws Exception {
Database db;
Product product=null;
ProductDetail detail = null;

db = _jdo.getDatabase();

// TA -1- //
db.begin();
product = (Product)db.load(Product.class, new Integer(4));
if (product == null) return;
product.setName("XXX");
detail = new ProductDetail();
detail.setName("aaa");
detail.setId(product.getId()*10 + 1);
product.addDetail(detail);
db.commit();

// TA -2- //
db.begin();
db.update(product); //-1-//
product.setName("YYY");
detail.setName("bbb");
db.commit();

db.close();
writer.println("Test complete");
}

When I run the example I get the exception
[test] org.exolab.castor.jdo.DuplicateIdentityException: update object which is already in the transaction
[test] org.exolab.castor.jdo.DuplicateIdentityException: update object which is already in the transaction
at //-1-//
but only if there's already one or more entries in the details table. If its empty the example works successfully.


Any hints or do I have to bugzilla.

Regards,
Michael

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




Reply via email to