Package com.xiaoleilu.hutool.db

Examples of com.xiaoleilu.hutool.db.Entity


   * @param rs 数据集
   * @return 每一行的Map
   * @throws SQLException
   */
  public static Entity handleRow(int columnCount, ResultSetMetaData meta, ResultSet rs) throws SQLException {
    final Entity row = Entity.create(meta.getTableName(1));
    String columnLabel;
    for (int i = 1; i <= columnCount; i++) {
      columnLabel = meta.getColumnLabel(i);
      row.put(columnLabel, rs.getObject(columnLabel));
    }
    return row;
  }
View Full Code Here


   * SqlRunner同时提供了带Connection参数的CRUD方法,方便外部提供Connection对象而由使用者提供事务的操作
   *
   * @param ds 数据源
   */
  private static void sqlRunnerDemo(DataSource ds) {
    Entity entity = Entity.create(TABLE_NAME).set("字段1", "值").set("字段2", 2);
    Entity where = Entity.create(TABLE_NAME).set("条件1", "条件值");

    try {
      SqlRunner runner = SqlRunner.create(ds);
      // 根据DataSource会自动识别数据库方言
      runner = SqlRunner.create(ds);
View Full Code Here

    } finally {
    }
  }

  private static void sessionDemo(DataSource ds) {
    Entity entity = Entity.create(TABLE_NAME).set("字段1", "值").set("字段2", 2);
    Entity where = Entity.create(TABLE_NAME).set("条件1", "条件值");

    Session session = Session.create(ds);
    try {
      session.beginTransaction();
View Full Code Here

TOP

Related Classes of com.xiaoleilu.hutool.db.Entity

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.