Exemple #1
0
 public void testSimpleObjectSelect() throws Exception {
   // Create test setup
   removeAll(Referrer.class);
   Referrer ref1 = new Referrer(1);
   Referrer ref2 = new Referrer(2);
   ref1.setRef(ref2);
   ref2.setRef(ref1);
   getStore().save(ref1);
   // Select ref1
   List result = getStore().find("find referrer where referrer.ref=?", new Object[] {ref2});
   Assert.assertEquals(result.size(), 1);
   Assert.assertEquals(result.get(0), ref1);
 }
Exemple #2
0
 public void testMultipleReferencedSelect() throws Exception {
   // Create test setup
   removeAll(Referrer.class);
   Referrer ref1 = new Referrer(1);
   Referrer ref2 = new Referrer(2);
   ref1.setRef(ref2);
   ref2.setRef(ref1);
   getStore().save(ref1);
   // Select ref1
   List result = getStore().find("find referrer where referrer.ref.ref.ref.ref.identity=2");
   Assert.assertEquals(result.size(), 1);
   Assert.assertEquals(result.get(0), ref2);
 }