Package com.googlecode.objectify.test.LoadParentRefTests

Examples of com.googlecode.objectify.test.LoadParentRefTests.ChildWithGroup


    Father f = new Father();
    f.foo = "foo";
    ofy().save().entity(f).now();

    ChildWithGroup ch = new ChildWithGroup();
    ch.father = Ref.create(Key.create(f));
    ch.bar = "bar";
    ofy().save().entity(ch).now();

    ofy().clear();

    // This should get an uninitialized ref
    ChildWithGroup fetched = ofy().load().entity(ch).now();
    assert fetched.father.key().getId() == f.id;
    assert !fetched.father.isLoaded();

    // This should get a filled in ref
    ChildWithGroup fetched2 = ofy().load().group(Group.class).key(Key.create(ch)).now();
    fetched2.father.get();
    assert fetched2.father.get().id.equals(f.id);
    assert fetched2.father.get().foo.equals(f.foo);
  }
View Full Code Here

TOP

Related Classes of com.googlecode.objectify.test.LoadParentRefTests.ChildWithGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.