/**
* Delete all objects in test data set.
*/
private void deleteTestDataSet() {
log("deleting test data set...");
QueryResults enumeration;
ManyGroup group = null;
ManyPerson person = null;
Database db = null;
try {
// select an group and delete it, if it exist!
db = this._category.getDatabase();
db.begin();
OQLQuery oqlclean = db.getOQLQuery(
"SELECT object FROM " + ManyGroup.class.getName()
+ " object WHERE object.id < $1");
oqlclean.bind(Integer.MAX_VALUE);
enumeration = oqlclean.execute();
while (enumeration.hasMore()) {
group = (ManyGroup) enumeration.next();
_stream.println("Retrieved object: " + group);
db.remove(group);
_stream.println("Deleted object: " + group);
}
db.commit();
db.begin();
oqlclean = db.getOQLQuery(
"SELECT object FROM " + ManyPerson.class.getName()
+ " object WHERE object.id < $1");
oqlclean.bind(Integer.MAX_VALUE);
enumeration = oqlclean.execute();
while (enumeration.hasMore()) {
person = (ManyPerson) enumeration.next();
_stream.println("Retrieved object: " + person);
db.remove(person);
_stream.println("Deleted object: " + person);
}
db.commit();