Examples of MyTable


Examples of org.nutz.dao.convent.tools.pojo.MyTable

      viewName=tableAnnotation.value();
    }else{
      viewName=viewAnnotation.value();
    }
//    得到表结构
    MyTable table=CollectData.getTableByTableName(tableName, conn,false);
    Entity<?> entity = new Entity<Object>();
    Mirror<?> mirror = Mirror.me(type);
    entity.setMirror(mirror);
    //设置表名
    entity.setTableName(EntityName.create(tableName));
View Full Code Here

Examples of org.nutz.dao.convent.tools.pojo.MyTable

      }
    }
    return foreignMap;
  }
  public MyTable getMyTable(String tableName) {
    MyTable table=new MyTable();
    table.setTableName(tableName);//设置表名
    MyField[] fields=this.getTableField(tableName);//得到表的属性数组
    table.setFields(fields);
    table.setInsertSql(this.buildInsertSql(tableName,fields));//设置插入语句(具体参考MyTable类)
    table.setUpdateSql(this.buildUpdateSql(tableName, fields));//设置更新语句
    table.setDeleteSql(this.buildDeleteSql(tableName, fields));//设置删除语句
    table.setSelectSql(this.buildSelectSql(tableName, fields));//设置选择语句
    return table;
  }
View Full Code Here

Examples of org.nutz.dao.convent.tools.pojo.MyTable

    List tables=new ArrayList();
    try {
      DatabaseMetaData metaData=conn.getMetaData();
      rs=metaData.getTables(conn.getCatalog(), metaData.getUserName(), null, new String[]{"TABLE"});
      while(rs.next()){
        MyTable table=this.getMyTable(rs.getString("TABLE_NAME"));
        tables.add(table);
      }
    } catch (Exception e) {
      throw new RuntimeException("将数据库的表转换为对象的时候出错",e);
    } finally{
View Full Code Here

Examples of org.nutz.dao.convent.tools.pojo.MyTable

  public static MyTable getTableByTableName(String tableName,Connection conn){
    return getTableByTableName(tableName, conn,true);
  }
  @SuppressWarnings("unchecked")
  public static MyTable getTableByTableName(String tableName,Connection conn,boolean autoClose){
    MyTable table=(MyTable) tableMap.get(tableName.toUpperCase());
    if(table!=null){
      return table;
    }
    //判断是否是懒加载
    if(!isLazy){//如果不是懒加载,又找不到就报错
      throw new RuntimeException("找不到该表名对应的表:"+tableName);
    }else{//如果是懒加载则取当前MyTable
      BuildMyTableForCommon builder=new BuildMyTableForCommon(conn);
      builder.setAutoClose(autoClose);
      table=builder.getMyTable(tableName);
      if(table!=null){
        tableMap.put(table.getTableName().toUpperCase(), table);//放入缓存
        return table;
      }
      throw new RuntimeException("找不到该表名对应的表:"+tableName);
    }
   
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.