Examples of EBasicClobNoVer


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

public class TestBasicClobNoVer extends BaseTestCase {

  @Test
  public void test() {

    EBasicClobNoVer entity = new EBasicClobNoVer();
    entity.setName("test");
    entity.setDescription("initialClobValue");
    EbeanServer server = Ebean.getServer(null);
    server.save(entity);

    String sqlNoClob = "select t0.id c0, t0.name c1 from ebasic_clob_no_ver t0 where t0.id = ?";
    String sqlWithClob = "select t0.id c0, t0.name c1, t0.description c2 from ebasic_clob_no_ver t0 where t0.id = ?";
   
   
    // Clob by default is Fetch Lazy
    Query<EBasicClobNoVer> defaultQuery = Ebean.find(EBasicClobNoVer.class).setId(entity.getId());
    defaultQuery.findUnique();
    String sql = defaultQuery.getGeneratedSql();

    Assert.assertTrue("Clob is fetch lazy by default", sql.contains(sqlNoClob));

   
    // Explicitly select * including Clob
    Query<EBasicClobNoVer> explicitQuery = Ebean.find(EBasicClobNoVer.class).setId(entity.getId()).select("*");

    explicitQuery.findUnique();
    sql = explicitQuery.getGeneratedSql();

    Assert.assertTrue("Explicitly include Clob", sql.contains(sqlWithClob));

    // Update description to test refresh
   
    EBasicClobNoVer updateBean = new EBasicClobNoVer();
    updateBean.setId(entity.getId());
    updateBean.setDescription("modified");
    Ebean.update(updateBean);
   
   
    // Test refresh function
   
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.