public class DaoTemplate extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected String |
primaryKeyField
本表的主键字段,请在子类中覆盖或构造方法中指定,默认为id
|
protected SqlRunner |
runner |
protected String |
tableName
表名
|
| 构造器和说明 |
|---|
DaoTemplate(String tableName) |
DaoTemplate(String tableName,
String primaryKeyField) |
DaoTemplate(String tableName,
String primaryKeyField,
SqlRunner runner) |
protected SqlRunner runner
protected String tableName
protected String primaryKeyField
public DaoTemplate(String tableName)
public Long add(Entity entity) throws SQLException
entity - 实体对象SQLExceptionpublic <T> int del(T pk)
throws SQLException
T - 主键类型pk - 主键SQLExceptionpublic int update(Entity entity) throws SQLException
entity - 实体对象,必须包含主键SQLExceptionpublic <T> Entity get(T pk) throws SQLException
T - pk - 主键值SQLExceptionSQLExceptionCopyright © 2015. All rights reserved.