Examples of NutDao


Examples of org.nutz.dao.impl.NutDao

    }

    protected EntityMaker createEntityMaker() {
      if (cycle)
        return new LazyAnnotationEntityMaker(dataSource, expert, holder, this);
        return new LazyAnnotationEntityMaker(dataSource, expert, holder, new NutDao(dataSource));
    }
View Full Code Here

Examples of org.nutz.dao.impl.NutDao

                it.remove();
        }
        //log.infof("Found %d table class", ks.size());
       
        JdbcExpert exp = Jdbcs.getExpert(ds);
        NutDao dao = new NutDao(ds);
       
        Method evalFieldType;
        try {
            evalFieldType = exp.getClass().getDeclaredMethod("evalFieldType", MappingField.class);
        } catch (Throwable e) {
            throw Lang.wrapThrow(e);
        }
        evalFieldType.setAccessible(true);
        Entity<?> entity = null;
        String line = "-------------------------------------------------------------------\n";
        sb.append("#title:数据字典\n");
        sb.append("#author:wendal\n");
        sb.append("#index:0,1\n").append(line);
        for (Class<?> klass : ks) {
            sb.append(line);
            entity = dao.getEntity(klass);
            sb.append("表名 ").append(entity.getTableName()).append("\n\n");
                if (!Strings.isBlank(entity.getTableComment()))
                    sb.append("表注释: ").append(entity.getTableComment());
                sb.append("\t").append("Java类名 ").append(klass.getName()).append("\n\n");
                sb.append("\t||序号||列名||数据类型||主键||非空||默认值||java属性名||java类型||注释||\n");
View Full Code Here

Examples of org.nutz.dao.impl.NutDao

  public void setDao(Dao dao) {
    this.dao = dao;
  }
 
  public void setDataSource(DataSource dataSource) {
    this.dao = new NutDao(dataSource);
  }
View Full Code Here

Examples of org.nutz.dao.impl.NutDao

                it.remove();
        }
        //log.infof("Found %d table class", ks.size());
       
        JdbcExpert exp = Jdbcs.getExpert(ds);
        NutDao dao = new NutDao(ds);
       
        Method evalFieldType;
        try {
            evalFieldType = exp.getClass().getDeclaredMethod("evalFieldType", MappingField.class);
        } catch (Throwable e) {
            throw Lang.wrapThrow(e);
        }
        evalFieldType.setAccessible(true);
        Entity<?> entity = null;
        String line = "-------------------------------------------------------------------\n";
        sb.append("#title:数据字典\n");
        sb.append("#author:wendal\n");
        sb.append("#index:0,1\n").append(line);
        for (Class<?> klass : ks) {
            sb.append(line);
            entity = dao.getEntity(klass);
            sb.append("表名 ").append(entity.getTableName()).append("\n\n");
                if (!Strings.isBlank(entity.getTableComment()))
                    sb.append("表注释: ").append(entity.getTableComment());
                sb.append("\t").append("Java类名 ").append(klass.getName()).append("\n\n");
                sb.append("\t||序号||列名||数据类型||主键||非空||默认值||java属性名||java类型||注释||\n");
View Full Code Here

Examples of org.nutz.dao.impl.NutDao

    ds.setPassword("sa");
    ds.setUrl("jdbc:h2:mem:~");
    ds.setDefaultAutoCommit(false);
    Json.toJson(ds);
   
    NutDao dao = new NutDao(ds);
   

    List<Pojo> list = new ArrayList<Pojo>();
    for (int i = 0; i < num; i++) {
      Pojo pojo = new Pojo();
      pojo.setName("abc"+i);
      list.add(pojo);
    }
   
    dao.create(Pojo.class, true);
    dao.fastInsert(list);
    System.out.println("预热完成,开始测试");
   
    //--------------------------------------------------
    dao.create(Pojo.class, true);
    dao(dao,list);
   
    dao.create(Pojo.class, true);
    jdbc(ds, list);
   
    dao.create(Pojo.class, true);
    dao(dao,list);
  }
View Full Code Here

Examples of org.nutz.dao.impl.NutDao

    ds.setUsername("postgres");
    ds.setPassword("123456");
    ds.setUrl("jdbc:postgresql:test");
    ds.setDefaultAutoCommit(false);
   
    final NutDao dao = new NutDao(ds);
   
    TableName.run(1, new Atom() {
      public void run() {
        Trans.exec(new Atom() {
          public void run() {
            dao.create(Country.class, true);
            System.out.println("------------???");
            dao.insert(Country.make("A"));
            try {
              System.out.println("---------------------");
              dao.insert(Country.make("A"));
              System.out.println("+++++++++++++++++++++++++++++++++++");
            }
            catch (DaoException e) {
            }
            try {
              dao.insert(Country.make("C"));
            } catch (Throwable e) {
              System.out.println("天啊,还是报错!!");
            }
          }
        });
View Full Code Here

Examples of org.nutz.dao.impl.NutDao

    }

    protected EntityMaker createEntityMaker() {
      if (cycle)
        return new LazyAnnotationEntityMaker(dataSource, expert, holder, this);
        return new LazyAnnotationEntityMaker(dataSource, expert, holder, new NutDao(dataSource));
    }
View Full Code Here

Examples of org.nutz.dao.impl.NutDao

    druid.setUsername(user);
    druid.setPassword(password);
    druid.setFilters("stat,trace,encoding");
    druid.setDefaultAutoCommit(false);

    dao_c3p0 = new NutDao(c3p0);
    dao_druid = new NutDao(druid);
    if (!dao_c3p0.exists("msg")) {
      dao_c3p0.execute(Sqls.create("create table msg(message varchar(5))")); // 字段长度5
    }
  }
View Full Code Here

Examples of org.nutz.dao.impl.NutDao

        this.dataSource = dataSource;
    }

    public void test_trans() throws Exception {
        Dao dao = new NutDao(dataSource);

        dao.clear("test");
        // doTran1(dao);
        doTran2(dao);
    }
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.