PersistenceManager pm = pmf.getPersistenceManager();
pm.currentTransaction().begin();
ArrayList al = new ArrayList();
al.add(new AutoIncFieldId());
al.add(new AutoIncFieldId());
Ref2AutoIncFieldId ref = new Ref2AutoIncFieldId(new AutoIncFieldId(), al);
pm.makePersistent(ref);
pm.currentTransaction().commit();
pm.currentTransaction().begin();
pm.deletePersistentAll(al);
pm.deletePersistent(ref.getSimpleRef());
pm.deletePersistent(ref);
pm.currentTransaction().commit();
pm.close();
} catch (Exception e) {
logger.log(BasicLevel.ERROR, "Exception", e);