public void setUp() throws PersistenceException { _jdo = _category.getJDO(); _jdo.setCallbackInterceptor(_i); _jdo.setInstanceFactory(_i); _db = _category.getDatabase(); OQLQuery oql; QueryResults qres; LOG.debug("Delete everything"); _db.begin(); oql = _db.getOQLQuery("SELECT p FROM " + TimeStampableObject.class.getName() + " p WHERE id=$1"); oql.bind(TimeStampableObject.DEFAULT_ID); qres = oql.execute(); while (qres.hasMore()) { _db.remove(qres.next()); } oql.close(); _db.commit(); }
public void tearDown() throws PersistenceException { if (_db.isActive()) { _db.rollback(); } OQLQuery oql; QueryResults qres; LOG.debug("Delete everything"); _db.begin(); oql = _db.getOQLQuery("SELECT p FROM " + TimeStampableObject.class.getName() + " p WHERE id=$1"); oql.bind(TimeStampableObject.DEFAULT_ID); qres = oql.execute(); while (qres.hasMore()) { _db.remove(qres.next()); } oql.close(); _db.commit(); _db.close(); _jdo.setCallbackInterceptor(null); }