I'm having some trouble using the PersistenceBroker to perform rollback on an object 
mapped with a simple inheritance hierarchy.

Here's how my classes are configured:

public class TNObject
{
   private Integer id;
   private String comment;
   // (setters and getters....)
}

public class TNHost extends TNObject
{
   private Integer type;
   private String name;
   // (setters and getters....)
}


If I insert record by the store() method (a TNHost object) and it's failed because 
internal database integrity  was not respected (field 'type' was NULL for example), I 
have a record in the TNObject table even if I abort the transaction...

This is my code:

PersistenceBroker _broker = PersistenceBrokerFactory.defaultPersistenceBroker();
try
    {
      _broker.beginTransaction();
      _broker.store(myHost);
      _broker.commitTransaction();
    }
    catch (PersistenceBrokerException pbe) {
      _broker.abortTransaction();
      System.out.println(pbe.getMessage());
      pbe.printStackTrace();
    }

So, what's wrong ????

Thanks for your help.


Thomas

Reply via email to