Package org.conserve.select

Examples of org.conserve.select.All


   */
  public void dropTable(ConnectionWrapper cw, Class<?> c) throws SQLException
  {
    // delete all the objects of this class
    // this ensures that all dependent objects are cleared, e.g. arrays.
    deleteObjects(cw, c, new All());
    persist.getTableManager().dropTableForClass(c, cw);
  }
View Full Code Here


    persist.saveObject(lso);
    persist.close();

    persist = new PersistenceManager(driver, database, login, password);
    // try getting all the objects
    List<BaseInterface> obs = persist.getObjects(BaseInterface.class, new All());
    assertEquals(1, obs.size());
    persist.close();
  }
View Full Code Here

    persist.saveObject(yetAnotherList);
    persist.close();

    persist = new PersistenceManager(driver, database, login, password);
    // retrieve objects by a sorted object
    List<Collection> allObjects = persist.getObjects(Collection.class, new All());
    assertEquals(3, allObjects.size());

    // find all objects that has the first entry equal to 'VALUE'.
    ArrayList<String> searchList = new ArrayList<String>();
    searchList.add("VALUE");
View Full Code Here

    persist.saveObject(yetAnotherMap);
    persist.close();

    persist = new PersistenceManager(driver, database, login, password);
    // get all objects
    List<Map> allObjects = persist.getObjects(Map.class, new All());
    assertEquals(3, allObjects.size());

    // search by map contents
    Map<String, Double> searchMap = new HashMap<String, Double>();
    searchMap.put("KEY", 3.0);
View Full Code Here

    SelfContainingObject sco = new SelfContainingObject();
    sco.setSelf(sco);
    persist.saveObject(sco);

    persist = new PersistenceManager(driver, database, login, password);
    List<SelfContainingObject> scos = persist.getObjects(SelfContainingObject.class, new All());
    assertEquals(1, scos.size());
    assertNotNull(scos.get(0).getSelf());

    Layer1 l1 = new Layer1();
    l1.setLayer2(new Layer2());
    l1.getLayer2().setLayer3(new Layer3());
    l1.getLayer2().getLayer3().setLayer1(l1);
    persist.saveObject(l1);
    persist.close();

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

    // it should not be possible to delete l2, since it is part of l1.
    List<Layer2> l2s = persist.getObjects(Layer2.class, new All());
    assertEquals(1, l2s.size());
    persist.deleteObjects(Layer2.class, new All());
    l2s = persist.getObjects(Layer2.class, new All());
    assertEquals(1, l2s.size());
    // it should not be possible to delete l3, since it is part of l2.
    List<Layer3> l3s = persist.getObjects(Layer3.class, new All());
    assertEquals(1, l3s.size());
    persist.deleteObjects(Layer3.class, new All());
    l3s = persist.getObjects(Layer3.class, new All());
    assertEquals(1, l3s.size());
    // it should be possible to delete l1.
    List<Layer1> l1s = persist.getObjects(Layer1.class, new All());
    assertEquals(1, l1s.size());
    persist.deleteObjects(Layer1.class, new All());
    l1s = persist.getObjects(Layer1.class, new All());
    assertEquals(0, l1s.size());
    // deleting l1 should remove l2 and l3.
    l3s = persist.getObjects(Layer3.class, new All());
    assertEquals(0, l3s.size());
    l2s = persist.getObjects(Layer2.class, new All());
    assertEquals(0, l2s.size());

    persist.close();

  }
View Full Code Here

    persist.saveObject(l1.getLayer2());
    persist.close();

    persist = new PersistenceManager(driver, database, login, password);
    // delete all self-containing objects
    persist.deleteObjects(Layer1.class, new All());
    persist.deleteObjects(Layer2.class, new All());
    List<Layer2> objects = persist.getObjects(Layer2.class, new All());

    // make sure no Layer2 objects remain
    assertEquals(0, objects.size());
  }
View Full Code Here

    persist.close();

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

    // assert that there are no ConcreteBar1 objects
    List<ConcreteBar1> cbar1s = persist.getObjects(ConcreteBar1.class, new All());
    assertEquals(0, cbar1s.size());

    // assert that there is one ConcreteBar2 object
    List<ConcreteBar2> cbar2s = persist.getObjects(ConcreteBar2.class, new All());
    assertEquals(1, cbar2s.size());

    // assert that there is one AbstractBar object
    List<AbstractBar> bars = persist.getObjects(AbstractBar.class, new All());
    assertEquals(1, bars.size());

    // create a Foo search object
    Foo searchFoo = new Foo();
View Full Code Here

    // re-open connection
    persist = new PersistenceManager(driver, database, login, password);

    // check that there are two FooContainerOwners
    List<FooContainerOwner> fooableowners = persist.getObjects(FooContainerOwner.class, new All());
    assertEquals(2, fooableowners.size());

    // check that there are two FooContainers
    List<FooContainer> fooables = persist.getObjects(FooContainer.class, new All());
    assertEquals(2, fooables.size());
    // check that there is one ExtendedFooContainer
    List<ExtendedFooContainer> extendedfooables = persist.getObjects(ExtendedFooContainer.class, new All());
    assertEquals(1, extendedfooables.size());

    FooContainerOwner searchObject = new FooContainerOwner();

    // get the first foo based on strict search
View Full Code Here

    // save the object
    persistOne.saveObject(so);

    // load the object from another instance
    List<SimpleObject> simpleObjects = persistTwo.getObjects(SimpleObject.class, new All());
    SimpleObject copy = simpleObjects.get(0);

    // alter the original object
    so.setName("altered");
    // save the altered object
View Full Code Here

    // save the objects
    persistOne.saveObject(layer1);

    // load the object from another instance
    List<Layer3> layer3s = persistTwo.getObjects(Layer3.class, new All());
    Layer3 copy = layer3s.get(0);

    // alter the original object
    layer3.getLayer1().setName("altered");
    // save the altered object
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.