use of org.datanucleus.samples.metadata.inh2.SubBase in project tests by datanucleus.
the class BasicTest method testInh2.
public void testInh2() {
try {
PersistenceManager pm = pmf.getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
Base base1 = new Base(1, "b1");
Base base2 = new Base(2, "b2");
Base base3 = new Base(3, "b3");
SubBase group1 = new SubBase(4, "b4", "SB1");
SubBase group2 = new SubBase(5, "b5", "SB2");
Container c = new Container(new Base[] { base1, base2, base3, group1, group2 });
pm.makePersistent(c);
tx.commit();
tx.begin();
Collection col = (Collection) pm.newQuery(SubBase.class).execute();
assertTrue(col.size() == 2);
assertTrue(col.contains(group1));
assertTrue(col.contains(group2));
tx.commit();
} finally {
if (tx.isActive()) {
tx.rollback();
}
pm.close();
}
} finally {
clean(Container.class);
clean(SubBase.class);
clean(Base.class);
}
}
Aggregations