Ejemplo n.º 1
0
  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();
  }
Ejemplo n.º 2
0
  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);
  }