Created
March 16, 2012 14:50
-
-
Save mgenov/2050396 to your computer and use it in GitHub Desktop.
ReferenceTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static class Parent { | |
@Id | |
Long id; | |
} | |
static class Child { | |
@Id | |
Long id; | |
Parent parent; | |
} | |
@Test | |
public void findChildOfAParent() { | |
ObjectDatastore datastore = new AnnotationObjectDatastore(); | |
Parent parent = new Parent(); | |
datastore.store().instance(parent).now(); | |
Child child = new Child(); | |
child.parent = parent; | |
datastore.store().instance(child).now(); | |
datastore.disassociateAll(); | |
List<Child> childList = datastore.find().type(Child.class) | |
.addFilter("parent", FilterOperator.EQUAL, parent).returnAll().now(); | |
assertThat(childList.size(),is(equalTo(1))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment