Package org.conserve.select

Examples of org.conserve.select.All


    pm = new PersistenceManager(driver, database, login, password);
    // change the database schema
    pm.updateSchema(SubClass.class);

    // search all SubClass, make sure both objects are returned
    List<SubClass> res2 = pm.getObjects(SubClass.class, new All());
    assertEquals(2, res2.size());

    // search all OriginalObject, make sure all objects are returned.
    List<OriginalObject> res3 = pm.getObjects(OriginalObject.class, new All());
    assertEquals(4, res3.size());

    // search all OriginalObject with name "foo", make sure SubClass
    // objects are returned.
    OriginalObject searchObject = new OriginalObject();
    searchObject.setName("foo");
    res3 = pm.getObjects(OriginalObject.class, new Equal(searchObject));
    assertEquals(1, res3.size());
    for (OriginalObject oo : res3)
    {
      assertTrue(oo instanceof SubClass);
    }

    // rename SubClass to to NotSubClass
    pm.changeName(SubClass.class, NotSubClass.class);
    // change the database schema
    pm.updateSchema(NotSubClass.class);

    // search all OriginalObject, make sure both objects are returned.
    res3 = pm.getObjects(OriginalObject.class, new All());
    assertEquals(2, res3.size());
    // search all NotSubClass, make sure both objects are returned
    List<NotSubClass> res1 = pm.getObjects(NotSubClass.class, new All());
    assertEquals(2, res1.size());
    // search NotSubClass, make sure only matchign object is returned
    NotSubClass searchObject2 = new NotSubClass();
    searchObject2.setName("foo");
    res1 = pm.getObjects(NotSubClass.class, new Equal(searchObject2));
View Full Code Here


    // change the database schema, adding interface Serialized.
    pm.updateSchema(ChangedInheritance.class);

    // search all Serializable, make sure both objects are returned
    List<Serializable> res1 = pm.getObjects(Serializable.class, new All());
    assertEquals(2, res1.size());
    // search all ChangedInheritance, make sure both objects are returned
    List<ChangedInheritance> res2 = pm.getObjects(ChangedInheritance.class, new All());
    assertEquals(2, res2.size());

    // search all OriginalObject, make sure no objects are returned.
    List<OriginalObject> res3 = pm.getObjects(OriginalObject.class, new All());
    assertEquals(0, res3.size());

    // rename ChangedInheritance to OriginalObject, thus removing the
    // interface
    pm.changeName(ChangedInheritance.class, OriginalObject.class);
    // change the database schema
    pm.updateSchema(OriginalObject.class);

    // search all Serializable, make sure no objects are returned
    res1 = pm.getObjects(Serializable.class, new All());
    assertEquals(0, res1.size());
    // search all ChangedInheritance, make sure no objects are returned.
    res2 = pm.getObjects(ChangedInheritance.class, new All());
    assertEquals(0, res2.size());
    // search all OriginalObject, make sure both objects are returned.
    res3 = pm.getObjects(OriginalObject.class, new All());
    assertEquals(2, res3.size());

    pm.close();
  }
View Full Code Here

    pm.close();

    pm = new PersistenceManager(driver, database, login, password);

    // search
    List<ListContainingObject> res = pm.getObjects(ListContainingObject.class, new All());
    assertEquals(2, res.size());
    for (ListContainingObject r : res)
    {
      assertNotNull(r.getList());
      assertTrue(3 < r.getList().size());
View Full Code Here

      existingClasses.remove(c);

      // remove all protection entries
      adapter.getPersist().getProtectionManager().unprotectObjects(cw, tableName);
      // delete all instances of the class
      adapter.getPersist().deleteObjects(cw, c, new All());
      // drop table of subclasses
      ArrayList<Class<?>> subClasses = this.getSubClasses(c, cw);
      for (Class<?> subClass : subClasses)
      {
        dropTableHelper(subClass, cw, classList);
View Full Code Here

TOP

Related Classes of org.conserve.select.All

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.