Esempio n. 1
0
 public void testSelectPrimitiveAttribute() throws Exception {
   removeAll(ObjectHolder.class);
   // Create
   ObjectHolder holder = new ObjectHolder();
   holder.setObj(new StringBuffer("String Ni").toString());
   getStore().save(holder);
   // Select
   List result = getStore().find("find objectholder where obj = 'String Ni'");
   Assert.assertEquals(result.size(), 1);
   result = getStore().find("find objectholder where obj = ?", new Object[] {"String Ni"});
   Assert.assertEquals(result.size(), 1);
 }
Esempio n. 2
0
 public void testRemovedObjectNonstorableAttributeSelect() throws Exception {
   // Drop
   removeAll(ObjectHolder.class);
   // Create book
   Author author = new Author("Joe", "Author");
   ObjectHolder holder = new ObjectHolder();
   holder.setObj(author);
   getStore().save(holder);
   // Remove author
   getStore().remove(author);
   // Run the select
   Assert.assertEquals(
       getStore()
           .find("find objectholder where objectholder.obj(author)=?", new Object[] {author})
           .size(),
       0);
 }