public void setUp() throws PersistenceException, SQLException { }
public void runTest() throws PersistenceException, SQLException {
OQLQuery oql;
TimeStampableObject object;
QueryResults enumeration;
// Remove and create the object
_db = _category.getDatabase();
_db.begin();
oql = _db.getOQLQuery("select obj from "
+ TimeStampableObject.class.getName() + " obj");
enumeration = oql.execute();
if (enumeration.hasMore()) {
object = (TimeStampableObject) enumeration.next();
LOG.debug("Removing object: " + object);
_db.remove(object);
}
_db.commit();
oql.close();
_db.close();
_db = _category.getDatabase();
_db.begin();
object = new TimeStampableObject();
LOG.debug("Creating new object: " + object);
_db.create(object);
_db.commit();
_db.close();
LOG.debug("Object timestamp: " + object.jdoGetTimeStamp());
// Load the object
_db = _category.getDatabase();
_db.begin();
oql = _db.getOQLQuery("select obj from "
+ TimeStampableObject.class.getName() + " obj");
enumeration = oql.execute();
if (enumeration.hasMore()) {
object = (TimeStampableObject) enumeration.next();
LOG.debug("Loaded object: " + object);
}
_db.rollback();
oql.close();
_db.close();