1 21 package com.db4o.test; 22 23 import java.util.*; 24 25 import com.db4o.query.*; 26 27 28 public class ObjectSetAsIterator { 29 30 public String name; 31 32 public ObjectSetAsIterator(){ 33 } 34 35 public ObjectSetAsIterator(String name){ 36 this.name = name; 37 } 38 39 public void store(){ 40 Test.deleteAllInstances(this); 41 Test.store(new ObjectSetAsIterator("one")); 42 Test.store(new ObjectSetAsIterator("two")); 43 Test.store(new ObjectSetAsIterator("three")); 44 } 45 46 public void test(){ 47 Query q = Test.query(); 48 q.constrain(ObjectSetAsIterator.class); 49 Iterator i = q.execute(); 50 boolean found = false; 51 while(i.hasNext()){ 52 ObjectSetAsIterator osil = (ObjectSetAsIterator)i.next(); 53 if(osil.name.equals("two")){ 54 found = true; 55 } 56 } 57 Test.ensure(found); 58 } 59 60 } 61 | Popular Tags |