public void test() {
    Query q = Test.query();
    q.constrain(TuningMemberFieldQuery.class);

    q.descend("member").descend("name").constrain("1");

    long start = System.currentTimeMillis();
    ObjectSet objectSet = q.execute();

    long stop = System.currentTimeMillis();

    Test.ensure(objectSet.size() == 1);
    TuningMemberFieldQuery tmf = (TuningMemberFieldQuery) objectSet.next();
    Test.ensure(tmf.member.name.equals("1"));

    long duration = stop - start;
    System.out.println("Querying " + COUNT + " objects for member identity: " + duration + "ms");
  }
예제 #2
0
  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);
  }