public void test() { Test.store(new Parent1(new Child1())); ObjectContainer container = Test.reOpen(); container .ext() .configure() .addAlias(new TypeAlias("com.db4o.test.aliases.Parent1", "com.db4o.test.aliases.Parent2")); container .ext() .configure() .addAlias(new TypeAlias("com.db4o.test.aliases.Child1", "com.db4o.test.aliases.Child2")); ObjectSet os = container.query(Parent2.class); Test.ensure(os.size() > 0); Parent2 p2 = (Parent2) os.next(); Test.ensure(p2.child != null); }
public void test() { ObjectContainer con = Test.objectContainer(); Test.deleteAllInstances(this); IsStored isStored = new IsStored(); isStored.myString = "isStored"; con.store(isStored); Test.ensure(con.ext().isStored(isStored)); Test.ensure(Test.occurrences(this) == 1); con.delete(isStored); Test.ensure(!con.ext().isStored(isStored)); Test.ensure(Test.occurrences(this) == 0); con.commit(); if (con.ext().isStored(isStored)) { // this will fail in CS due to locally cached references if (!Test.clientServer) { Test.error(); } } Test.ensure(Test.occurrences(this) == 0); con.store(isStored); Test.ensure(con.ext().isStored(isStored)); Test.ensure(Test.occurrences(this) == 1); con.commit(); Test.ensure(con.ext().isStored(isStored)); Test.ensure(Test.occurrences(this) == 1); con.delete(isStored); Test.ensure(!con.ext().isStored(isStored)); Test.ensure(Test.occurrences(this) == 0); con.commit(); if (con.ext().isStored(isStored)) { // this will fail in CS due to locally cached references if (!Test.clientServer) { Test.error(); } } Test.ensure(Test.occurrences(this) == 0); }