|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectcom.aiyc.server.standalone.db.homes.EntityHome<T>
public abstract class EntityHome<T extends IEntity<Integer>>
| 字段摘要 | |
|---|---|
protected String |
area
|
protected com.waspring.wasdbtools.DatabaseConnection |
db
|
protected String |
deleteSQL
|
protected String |
insertSQL
|
protected Logger |
log
|
protected int |
primaryKeyId
|
protected String |
selectSQL
|
protected String |
TableColNames
|
protected String |
updateSQL
|
| 构造方法摘要 | |
|---|---|
EntityHome()
|
|
| 方法摘要 | |
|---|---|
List<T> |
add(List<T> list)
Add a list of entities |
T |
add(T e)
Add an entity to the database. |
int |
executeInsertUpdate(Vector<PreparedStatement> vps,
T e)
|
protected int |
fillInStatement(PreparedStatement ps,
Object[] values,
int[] sqlTypes)
|
protected int |
fillInStatement(PreparedStatement ps,
Object[] values,
int[] sqlTypes,
int fromIndex)
Fills values into the PreparedStatement starting at fromIndex |
protected int |
fillInStatement(PreparedStatement ps,
T e)
|
protected abstract int |
fillInStatement(PreparedStatement ps,
T e,
int fromIndex)
Fills entity values into the PreparedStatement starting at
fromIndex |
List<T> |
get(List<T> list)
Get a List of entities |
protected List<T> |
get(String constraint)
Gets entities from database matching a constraint |
T |
get(T e)
Get an entity |
List<T> |
getAll()
Get all entities |
String |
getArea()
|
T |
getById(Integer id)
Get an entity by it's primary key |
List<T> |
getById(List<Integer> ids)
Get a List of entities by their primary keys |
T |
getByName(String name)
|
protected String |
getDeleteSQL()
|
protected ResultSet |
getGeneratedKey(PreparedStatement ps)
Helper function to get generated key Does consider different methods of retrieving the generated keys depending on the database |
protected String |
getInsertSQL()
|
protected String |
getOrder()
|
protected PreparedStatement |
getPreparedStatement(String sql)
Helper function to get a prepared statement. |
protected int |
getPrimaryKeyId()
|
protected String |
getSelectSQL()
|
protected String |
getTableColNames()
|
protected abstract String[] |
getTableCols()
|
protected abstract String |
getTableIdCol()
|
protected abstract String |
getTableName()
|
protected String |
getUpdateSQL()
|
protected static String |
implode(Object[] obj)
|
protected T |
parseResultRow(ResultSet rs)
|
abstract T |
parseResultRow(ResultSet rs,
int fromIndex)
This function restores an entity from a database row |
boolean |
remove(List<T> list)
Removes a List of entities |
protected boolean |
remove(String constraint)
Removes entities from database matching a constraint |
boolean |
remove(T e)
Removes an entity |
boolean |
removeAll()
Removes all entities from database |
void |
setArea(String area)
|
boolean |
update(List<T> list)
Updates a List of entities |
boolean |
update(T e)
Updates an entity |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
protected String area
protected int primaryKeyId
protected com.waspring.wasdbtools.DatabaseConnection db
protected Logger log
protected String TableColNames
protected String insertSQL
protected String updateSQL
protected String selectSQL
protected String deleteSQL
| 构造方法详细信息 |
|---|
public EntityHome()
| 方法详细信息 |
|---|
public String getArea()
IArea 中的 getAreapublic void setArea(String area)
IArea 中的 setAreaprotected abstract String getTableName()
protected String getTableColNames()
protected int getPrimaryKeyId()
protected String getInsertSQL()
protected String getUpdateSQL()
protected String getSelectSQL()
protected String getOrder()
protected String getDeleteSQL()
protected abstract String getTableIdCol()
protected abstract String[] getTableCols()
protected T parseResultRow(ResultSet rs)
throws SQLException
rs - ResultSet
SQLExceptionparseResultRow(ResultSet, int)
public abstract T parseResultRow(ResultSet rs,
int fromIndex)
throws SQLException
rs - ResultSetfromIndex - index from where the parsing starts
SQLException
protected int fillInStatement(PreparedStatement ps,
Object[] values,
int[] sqlTypes)
throws SQLException
ps - PreparedStatementvalues - entity valuessqlTypes - corresponding SQL Types for values
SQLExceptionfillInStatement(PreparedStatement, Object[], int[], int)
protected int fillInStatement(PreparedStatement ps,
Object[] values,
int[] sqlTypes,
int fromIndex)
throws SQLException
PreparedStatement starting at fromIndex
ps - PreparedStatementvalues - entity valuessqlTypes - corresponding SQL Types for valuesfromIndex - index from where the filling in starts
SQLException
protected int fillInStatement(PreparedStatement ps,
T e)
throws SQLException
ps - PreparedStatemente - Entity
SQLExceptionfillInStatement(PreparedStatement, IEntity, int)
protected abstract int fillInStatement(PreparedStatement ps,
T e,
int fromIndex)
throws SQLException
PreparedStatement starting at
fromIndex
ps - PreparedStatemente - Entity
SQLException
public int executeInsertUpdate(Vector<PreparedStatement> vps,
T e)
throws SQLException
vps - Vector<PreparedStatement>e - entity
SQLExceptionpublic T add(T e)
IEntityHome<T extends IEntity<Integer>,Integer> 中的 adde - Entity
public List<T> add(List<T> list)
IEntityHome<T extends IEntity<Integer>,Integer> 中的 addlist - List of entities
List of entities with their generated primary keysprotected List<T> get(String constraint)
constraint - SQL WHERE constraint
List of entities matching the constraintpublic T get(T e)
IEntityHome<T extends IEntity<Integer>,Integer> 中的 gete - Entity
public T getById(Integer id)
IEntityHome<T extends IEntity<Integer>,Integer> 中的 getByIdid - Primary Key
public T getByName(String name)
public List<T> get(List<T> list)
List of entities
IEntityHome<T extends IEntity<Integer>,Integer> 中的 getlist - List of primary keys
List of entitiespublic List<T> getById(List<Integer> ids)
List of entities by their primary keys
IEntityHome<T extends IEntity<Integer>,Integer> 中的 getByIdids - List of primary keys
List of entitiespublic List<T> getAll()
IEntityHome<T extends IEntity<Integer>,Integer> 中的 getAllList of all entitiesprotected boolean remove(String constraint)
constraint - SQL WHERE constraint
public boolean remove(T e)
IEntityHome<T extends IEntity<Integer>,Integer> 中的 removee - Entity
public boolean remove(List<T> list)
List of entities
IEntityHome<T extends IEntity<Integer>,Integer> 中的 removelist - List of entities
public boolean removeAll()
IEntityHome<T extends IEntity<Integer>,Integer> 中的 removeAllpublic boolean update(T e)
IEntityHome<T extends IEntity<Integer>,Integer> 中的 updatee - Entity
public boolean update(List<T> list)
List of entities
IEntityHome<T extends IEntity<Integer>,Integer> 中的 updatelist - List of entities to be updated
true if all entities were updated successfully
protected PreparedStatement getPreparedStatement(String sql)
throws SQLException
sql - SQL command
PreparedStatement
SQLException
protected ResultSet getGeneratedKey(PreparedStatement ps)
throws SQLException
ps - PreparedStatement
ResultSet with generated key
SQLExceptionprotected static String implode(Object[] obj)
obj - Objects to be imploded
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||