Examples of CKeyParent


Examples of com.avaje.tests.model.basic.CKeyParent

  public void test() {

    CKeyParentId id = new CKeyParentId(100, "deleteMe");
    CKeyParentId searchId = new CKeyParentId(100, "deleteMe");

    CKeyParent p = new CKeyParent();
    p.setId(id);
    p.setName("testDelete");

    Ebean.save(p);

    CKeyParent found = Ebean.find(CKeyParent.class).where().idEq(searchId).findUnique();

    Assert.assertNotNull(found);

    Ebean.delete(CKeyParent.class, searchId);

    CKeyParent notFound = Ebean.find(CKeyParent.class).where().idEq(searchId).findUnique();

    Assert.assertNull(notFound);

  }
View Full Code Here

Examples of com.avaje.tests.model.basic.CKeyParent

    CKeyAssoc assoc = new CKeyAssoc();
    assoc.setAssocOne("assocOne");

    CKeyParentId id = new CKeyParentId(1, "one");

    CKeyParent p = new CKeyParent();
    p.setId(id);
    p.setName("testone");
    p.setAssoc(assoc);
    p.add(new CKeyDetail("somethine one"));
    p.add(new CKeyDetail("somethine two"));

    Ebean.save(p);

    CKeyAssoc assoc2 = new CKeyAssoc();
    assoc2.setAssocOne("assocTwo");

    CKeyParentId id2 = new CKeyParentId(2, "two");

    CKeyParent p2 = new CKeyParent();
    p2.setId(id2);
    p2.setName("testone");
    p2.setAssoc(assoc2);
    p2.add(new CKeyDetail("somethine one"));
    p2.add(new CKeyDetail("somethine two"));

    Ebean.save(p2);

    CKeyParentId searchId = new CKeyParentId(1, "one");

    CKeyParent found = Ebean.find(CKeyParent.class).where().idEq(searchId).findUnique();

    Assert.assertNotNull(found);
    Assert.assertEquals(2,found.getDetails().size());

    List<CKeyParent> list = Ebean.find(CKeyParent.class).findList();

    Assert.assertTrue(list.size() > 1);

    CKeyParent foundFirst = list.get(0);
    List<CKeyDetail> details = foundFirst.getDetails();

    int size = details.size();
    Assert.assertTrue(size > 0);

    List<Object> idList = new ArrayList<Object>();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.