Examples of UUOne


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

public class TestBatchLazyWithDeleted extends BaseTestCase {

  @Test
  public void testOnDeleted() {

    UUOne oneA = new UUOne();
    oneA.setName("oneA");

    UUOne oneB = new UUOne();
    oneB.setName("oneB");

    UUTwo two = new UUTwo();
    two.setName("two-bld-A");
    two.setMaster(oneA);

    UUTwo twoB = new UUTwo();
    twoB.setName("two-bld-B");
    twoB.setMaster(oneA);

    UUTwo twoC = new UUTwo();
    twoC.setName("two-bld-C");
    twoC.setMaster(oneB);

    Ebean.save(oneA);
    Ebean.save(oneB);
    Ebean.save(two);
    Ebean.save(twoB);
    Ebean.save(twoC);

    List<UUTwo> list = Ebean.find(UUTwo.class)
        .fetch("master", new FetchConfig().lazy(5))
        .where().startsWith("name", "two-bld-")
        .order("name")
        .findList();

    // delete a bean that will be batch lazy loaded but
    // is NOT the bean that will invoke the lazy loading
    // (in this case it is the second bean in the list).
    int deletedCount = Ebean.delete(UUOne.class, oneB.getId());
    Assert.assertEquals(1, deletedCount);

    for (UUTwo u : list) {
      u.getMaster();
      //BeanState beanState = Ebean.getBeanState(master);
View Full Code Here

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

  @Test
  public void testSimple() {

    UUID uuid = UUID.randomUUID();
    UUOne one = Ebean.getReference(UUOne.class, uuid);

    try {
      // invoke lazy loading
      one.getName();
      Assert.assertTrue(false);
    } catch (EntityNotFoundException e) {
      // expecting this
      Assert.assertTrue(true);
    }
View Full Code Here

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

import com.avaje.tests.model.basic.UUOne;

public class TestBatchLazyWithCacheHits extends BaseTestCase {

  private UUOne insert(String name) {
    UUOne one = new UUOne();
    one.setName("test-BLWCH-"+name);
    Ebean.save(one);
    return one;
  }
View Full Code Here

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

    }
   
    ServerCacheManager serverCacheManager = Ebean.getServerCacheManager();
    serverCacheManager.setCaching(UUOne.class, true);
   
    UUOne b = Ebean.find(UUOne.class)
      .setId(inserted.get(1).getId())
      .setUseCache(true)
      .findUnique();

    Assert.assertNotNull(b);
   
    UUOne b2 = Ebean.find(UUOne.class)
        .where().idEq(inserted.get(1).getId())
        .setUseCache(true)
        .findUnique();
   
    Assert.assertNotNull(b2);
   
    UUOne c = Ebean.find(UUOne.class)
        .where().idEq(inserted.get(2).getId())
        .setUseCache(true)
        .findUnique();
   
    Assert.assertNotNull(c);
   
    UUOne c2 = Ebean.find(UUOne.class)
        .where().idEq(inserted.get(2).getId())
        .setUseCache(true)
        .findUnique();
   
    Assert.assertNotNull(c2);
View Full Code Here

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

    two.setName("something");

    ArrayList<UUTwo> list = new ArrayList<UUTwo>();
    list.add(two);

    UUOne one = new UUOne();
    one.setName("some one");
    one.setComments(list);

    Ebean.save(one);

    UUOne oneB = Ebean.find(UUOne.class, one.getId());

    UUTwo twoB = new UUTwo();
    twoB.setName("another something");
    oneB.getComments().add(twoB);

    Ebean.save(oneB);
  }
View Full Code Here

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

public class TestJsonStatelessUpdate extends BaseTestCase {

  @Test
  public void test() throws IOException {
   
    UUOne one = new UUOne();
    one.setName("oneName");

    Ebean.save(one);

    UUTwo two = new UUTwo();
    two.setMaster(one);
View Full Code Here

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

  @Test
  public void test() {
   
  
    UUOne one0 = new UUOne();
    one0.setName("first one");

    UUID id = UUID.randomUUID();
    UUOne one1 = new UUOne();
    one1.setId(id);
    one1.setName("second one");

    Ebean.save(one0);
    Ebean.save(one1);
   
    UUOne fetch0 = Ebean.find(UUOne.class, one0.getId());
    UUOne fetch1 = Ebean.find(UUOne.class, one1.getId());
   
    Assert.assertEquals(one0.getId(), fetch0.getId());
    Assert.assertEquals(one0.getName(), fetch0.getName());

    Assert.assertEquals(one1.getId(), fetch1.getId());
    Assert.assertEquals(one1.getName(), fetch1.getName());

    String sql = "select id, name from uuone";
    List<SqlRow> list = Ebean.createSqlQuery(sql).findList();
    for (SqlRow sqlRow : list) {
      Object sqlId = sqlRow.get("id");
View Full Code Here

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

  @Test
  public void test() {
   
    // setup
    UUOne master1 = new UUOne();
    master1.setName("testDisjOuter_1_name");

    UUTwo detail1 = new UUTwo();
    detail1.setMaster(master1);
    detail1.setName("testDisjOuter_CHILD_1");

    UUOne master2 = new UUOne();
    master2.setName("testDisjOuter_2_name");

    Ebean.save(master1);
    Ebean.save(detail1);
    Ebean.save(master2);
   
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.