Package com.avaje.ebean

Examples of com.avaje.ebean.FetchConfig


    ResetBasicData.reset();

    EbeanServer server = Ebean.getServer(null);

    Query<Customer> query = server.find(Customer.class).setAutofetch(false)
        .fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).orderBy("id")
        .setMaxRows(2);

    final AtomicInteger counter = new AtomicInteger(0);

    query.findVisit(new QueryResultVisitor<Customer>() {
View Full Code Here


    ResetBasicData.reset();

    EbeanServer server = Ebean.getServer(null);

    Query<Customer> query = server.find(Customer.class).setAutofetch(false)
        .fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).orderBy("id")
        .setMaxRows(2);

    final AtomicInteger counter = new AtomicInteger(0);

    query.findVisit(new QueryResultVisitor<Customer>() {
View Full Code Here

    ResetBasicData.reset();

    Query<Order> q = Ebean.find(Order.class)
        .fetch("customer")
        .fetch("customer.contacts")
        .fetch("details", new FetchConfig().query(10))
        .fetch("details.product")
        .where().gt("id", 0).query();

    List<Order> list = q.findList();
    String sql = q.getGeneratedSql();
View Full Code Here

    ResetBasicData.reset();

    List<Order> list = Ebean.find(Order.class)
        .fetch("customer")
        .fetch("customer.contacts", "firstName", new FetchConfig().query().lazy(10))
        .fetch("customer.contacts.group")
        .where().lt("id", 3).findList();

    Assert.assertNotNull(list);
    Assert.assertTrue(list.size() > 0);
View Full Code Here

    if (queryFetchBatch > 0) {
      // property join was automatically set to a 'query join'
      return queryFetchBatch;
    }
   
    FetchConfig fetchConfig = queryProps.getFetchConfig();
    if (fetchConfig == null) {
      return batchSize;
    }
   
    int queryBatchSize = fetchConfig.getQueryBatchSize();
    if (queryBatchSize == -1) {
      // not eager query fetch, just lazy loading
      return batchSize;

    } else if (queryBatchSize == 0) {
View Full Code Here

 
  private int initSecondaryBatchSize(int defaultBatchSize, int firstBatchSize, OrmQueryProperties queryProps) {
    if (queryProps == null) {
      return defaultBatchSize;
    }
    FetchConfig fetchConfig = queryProps.getFetchConfig();
    if (fetchConfig == null) {
      return defaultBatchSize;
    }
    if (fetchConfig.isQueryAll()) {
      return firstBatchSize;
    }
   
    int lazyBatchSize = fetchConfig.getLazyBatchSize();
    return (lazyBatchSize > 1) ? lazyBatchSize : defaultBatchSize;
  }
View Full Code Here

TOP

Related Classes of com.avaje.ebean.FetchConfig

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.