Package com.avaje.ebeaninternal.api

Examples of com.avaje.ebeaninternal.api.HashQueryPlanBuilder


    // exclude bind values and things unrelated to
    // the sql being generated

    if (builder == null) {
      builder = new HashQueryPlanBuilder();
    }

    builder.add((type == null ? 0 : type.ordinal() + 1));
    builder.add(autoFetchTuned).add(distinct).add(sqlDistinct).add(query);
    builder.add(firstRow).add(maxRows).add(orderBy).add(forUpdate);
View Full Code Here


  @Test
  public void test() {
   

    HashQueryPlanBuilder builder1 = new HashQueryPlanBuilder();
   
    SpiQuery<Order> squery = (SpiQuery<Order>)Ebean.find(Order.class);
    squery.queryAutofetchHash(builder1);
   
    squery.where().in("id", 1,2,3);

    HashQueryPlanBuilder builder2 = new HashQueryPlanBuilder();
    squery.queryAutofetchHash(builder2);
    int q1BindHash = squery.queryBindHash();
   
    Assert.assertNotSame(builder1.build(), builder2.build());

    HashQueryPlanBuilder builder3 = new HashQueryPlanBuilder();
    SpiQuery<Order> squery2 = (SpiQuery<Order>)Ebean.find(Order.class);
    squery2.where().in("id", 2,2,3);

    squery2.queryAutofetchHash(builder3);
    int q2BindHash = squery2.queryBindHash();

    Assert.assertEquals(builder3.build(), builder2.build());   
    Assert.assertTrue(q1BindHash != q2BindHash);

    HashQueryPlanBuilder builder4 = new HashQueryPlanBuilder();
    SpiQuery<Order> squery4 = (SpiQuery<Order>)Ebean.find(Order.class);
    squery4.where().in("name", 2,2,3);

    squery4.queryAutofetchHash(builder4);
    int q4BindHash = squery4.queryBindHash();

    //different query plan
    Assert.assertTrue(!builder3.build().equals(builder4.build()));   
   
    //same bind hash
    Assert.assertTrue(q4BindHash == q2BindHash);

  }
View Full Code Here

    this.encryptedProps = sqlTree.getEncryptedProps();
  }


  private HashQueryPlan buildHash(String sql, boolean rawSql, boolean rowNumberIncluded, String logWhereSql) {
    HashQueryPlanBuilder builder = new HashQueryPlanBuilder();
    builder.add(sql).add(rawSql).add(rowNumberIncluded).add(logWhereSql);
    builder.addRawSql(sql);
    return builder.build();
  }
View Full Code Here

TOP

Related Classes of com.avaje.ebeaninternal.api.HashQueryPlanBuilder

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.