Examples of FetchConfig


Examples of com.avaje.ebean.FetchConfig

    Contact con = new Contact("jim", "slim");
    c.addContact(con);

    Ebean.save(c);

    List<Customer> list = Ebean.find(Customer.class).fetch("contacts", new FetchConfig().query(0))
        .fetch("contacts.notes", new FetchConfig().query(100)).findList();

    for (Customer customer : list) {
      List<Contact> contacts = customer.getContacts();
      for (Contact contact : contacts) {
        contact.getNotes();
View Full Code Here

Examples of com.avaje.ebean.FetchConfig

    ResetBasicData.reset();

    // This will use 3 SQL queries to build this object graph
    List<Order> l0 = Ebean.find(Order.class).select("status, shipDate")
        .fetch("details", "orderQty, unitPrice", new FetchConfig().query())
        .fetch("details.product", "sku, name")

        // .join("customer", "name", new JoinConfig().query(10))
        // .join("customer.contacts","firstName, lastName, mobile")
        // .join("customer.shippingAddress","line1, city")
View Full Code Here

Examples of com.avaje.ebean.FetchConfig

  public void test() {

    ResetBasicData.reset();

    List<Order> list = Ebean.find(Order.class)
        .fetch("details", new FetchConfig().query())
        .order().asc("id")
        .order().desc("details.id").findList();

    Assert.assertNotNull(list);

    List<Order> list2 = Ebean.find(Order.class)
        .fetch("customer", new FetchConfig().query(5))
        .fetch("customer.contacts")
        .order().asc("id")
        .order().asc("customer.contacts.lastName")
        .findList();
View Full Code Here

Examples of com.avaje.ebean.FetchConfig

  @Test
  public void test() {

    ResetBasicData.reset();

    Query<Customer> query = Ebean.find(Customer.class).fetch("orders", new FetchConfig().lazy())
        .where().ilike("name", "Rob%").filterMany("orders").eq("status", Order.Status.NEW).where()
        .gt("id", 0).query();

    // query.filterMany("orders").eq("status", Order.Status.NEW);
View Full Code Here

Examples of com.avaje.ebean.FetchConfig

    new FetchThread(tg, 0).start();
    new FetchThread(tg, 1).start();
    new FetchThread(tg, 2).start();
    new FetchThread(tg, 3).start();

    orders = Ebean.find(Order.class).fetch("customer", new FetchConfig().lazy(100)).findList();
    Assert.assertTrue(orders.size() >= 4);

    try {
      MyTestDataSourcePoolListener.SLEEP_AFTER_BORROW = 2000;
View Full Code Here

Examples of com.avaje.ebean.FetchConfig

    List<Customer> list = Ebean
        .find(Customer.class)
        // .join("orders", new JoinConfig().lazy())
        // .join("orders", new JoinConfig().query())
        .fetch("orders").fetch("contacts", new FetchConfig().query()).where().ilike("name", "rob%")
        .filterMany("orders").eq("status", Order.Status.NEW).gt("orderDate", lastWeek)
        .filterMany("contacts").isNotNull("firstName").findList();

    System.out.println(list);
    // invoke lazy loading
View Full Code Here

Examples of com.avaje.ebean.FetchConfig

    cnew.setName("testSecQueryNoRows");

    Ebean.save(cnew);

    Customer c = Ebean.find(Customer.class).setAutofetch(false).setId(cnew.getId())
        .fetch("contacts", new FetchConfig().query()).findUnique();

    Assert.assertNotNull(c);
  }
View Full Code Here

Examples of com.avaje.ebean.FetchConfig

  public void testFilterManyWithSimplePredicate() {

    ResetBasicData.reset();

    Query<Customer> query = Ebean.find(Customer.class)
        .fetch("orders", new FetchConfig().query())
        .where().ilike("name", "Rob%").gt("id", 0)
        .filterMany("orders").eq("status", Order.Status.NEW)
        .query();

    List<Customer> list = query.findList();
View Full Code Here

Examples of com.avaje.ebean.FetchConfig

  public void testFilterManyWithPathPredicate() {
   
    ResetBasicData.reset();
   
    Query<Order> query = Ebean.find(Order.class)
      .fetch("details", new FetchConfig().query())
      .fetch("details.product","name")
      .filterMany("details").ilike("product.name", "c%")
      .query();
   
    List<Order> orders = query.findList();
View Full Code Here

Examples of com.avaje.ebean.FetchConfig

  @Test
  public void test() {

    ResetBasicData.reset();

    Ebean.find(Customer.class).fetch("orders", new FetchConfig().query())
        .fetch("orders.details", new FetchConfig().query())
        .fetch("orders.shipments", new FetchConfig().query())
        .fetch("shippingAddress", new FetchConfig().query())
        .fetch("billingAddress", new FetchConfig().query()).findList();

  }
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.