String name = "testUnBind_" + System.currentTimeMillis();
Transaction tx = odmg.newTransaction();
//bind object to name
tx.begin();
Article example = createArticle();
database.makePersistent(example);
tx.commit();
// 1. perform binding
tx.begin();
try
{
database.bind(example, name);
tx.commit();
}
catch (ObjectNameNotUniqueException ex)
{
tx.abort();
fail(ex.getMessage());
}
// 2. perform unbind
tx = odmg.newTransaction();
tx.begin();
try
{
database.unbind(name);
tx.commit();
}
catch (ObjectNameNotFoundException ex)
{
tx.abort();
fail("name " + name + "should be known");
}
// 3. check if name is really unknown now
tx = odmg.newTransaction();
tx.begin();
try
{
Article value = (Article) database.lookup(name);
assertNotNull("Should not find unbind name '" + name+"'", value);
fail("name " + name + " should not be known after unbind");
}
catch (ObjectNameNotFoundException ex)
{