@Test
public void testFooWithExistingBar() throws Exception {

	repository.insert(new Bar());
	Bar bar = repository.query(new Bar()).single();
	Foo foo = new Foo();
	foo.barP.set(bar);
	foo.barsP.set(Arrays.asList(bar));
	repository.insert(foo);
	assertEquals(1, repository.query(new Foo()).count());
	assertEquals(1, repository.query(new Bar()).count());
}