|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjp.sf.amateras.mirage.SqlManagerImpl
public class SqlManagerImpl
| Field Summary | |
|---|---|
protected boolean |
cacheMode
|
protected CallExecutor |
callExecutor
|
protected ConnectionProvider |
connectionProvider
|
protected Dialect |
dialect
|
protected NameConverter |
nameConverter
|
protected Map<String,Node> |
nodeCache
|
protected SqlExecutor |
sqlExecutor
|
| Constructor Summary | |
|---|---|
SqlManagerImpl()
|
|
| Method Summary | ||
|---|---|---|
void |
addValueType(ValueType<?> valueType)
Adds the implementation of the ValueType. |
|
|
call(Class<T> resultClass,
String functionName)
|
|
|
call(Class<T> resultClass,
String functionName,
Object param)
|
|
void |
call(String procedureName)
Invokes the stored procedure. |
|
void |
call(String procedureName,
Object parameter)
Invokes the stored procedure. |
|
|
callForList(Class<T> resultClass,
String functionName)
|
|
|
callForList(Class<T> resultClass,
String functionName,
Object param)
|
|
|
deleteBatch(List<T> entities)
Deletes given entities in batch mode. |
|
|
deleteBatch(T... entities)
Deletes given entities in batch mode. |
|
int |
deleteEntity(Object entity)
Deletes the given entity. |
|
int |
executeUpdate(String sqlPath)
|
|
int |
executeUpdate(String sqlPath,
Object param)
|
|
int |
executeUpdateBySql(String sql)
Executes the given SQL. |
|
int |
executeUpdateBySql(String sql,
Object... params)
Executes the given SQL with parameters. |
|
|
findEntity(Class<T> clazz,
Object... id)
Finds the entity by the given primary key. |
|
ConnectionProvider |
getConnectionProvider()
|
|
int |
getCount(String sqlPath)
Returns the row count of the result of the given SQL. |
|
int |
getCount(String sqlPath,
Object param)
Returns the row count of the result of the given SQL. |
|
int |
getCountBySql(String sql)
|
|
int |
getCountBySql(String sql,
Object... params)
|
|
Dialect |
getDialect()
|
|
NameConverter |
getNameConverter()
|
|
|
getResultList(Class<T> clazz,
String sqlPath)
|
|
|
getResultList(Class<T> clazz,
String sqlPath,
Object param)
|
|
|
getResultListBySql(Class<T> clazz,
String sql)
|
|
|
getResultListBySql(Class<T> clazz,
String sql,
Object... params)
|
|
|
getSingleResult(Class<T> clazz,
String sqlPath)
|
|
|
getSingleResult(Class<T> clazz,
String sqlPath,
Object param)
|
|
|
getSingleResultBySql(Class<T> clazz,
String sql)
|
|
|
getSingleResultBySql(Class<T> clazz,
String sql,
Object... params)
|
|
|
insertBatch(List<T> entities)
Inserts given entities in batch mode. |
|
|
insertBatch(T... entities)
Inserts given entities in batch mode. |
|
int |
insertEntity(Object entity)
Inserts the given entity. |
|
|
iterate(Class<T> clazz,
IterationCallback<T,R> callback,
String sqlPath)
|
|
|
iterate(Class<T> clazz,
IterationCallback<T,R> callback,
String sqlPath,
Object param)
|
|
|
iterateBySql(Class<T> clazz,
IterationCallback<T,R> callback,
String sql)
|
|
|
iterateBySql(Class<T> clazz,
IterationCallback<T,R> callback,
String sql,
Object... params)
|
|
protected boolean |
needsParameter(PropertyDesc pd)
|
|
protected Node |
prepareNode(String sqlPath)
|
|
protected SqlContext |
prepareSqlContext(Object param)
|
|
void |
setCacheMode(boolean cacheMode)
|
|
void |
setConnectionProvider(ConnectionProvider connectionProvider)
Sets the implementation of ConnectionProvider. |
|
void |
setDialect(Dialect dialect)
Sets the implementation of the Dialect. |
|
void |
setEntityCreator(ResultEntityCreator entityCreator)
Sets the implementation of the ResultEntityCreator. |
|
void |
setNameConverter(NameConverter nameConverter)
Sets the implementation of NameConverter. |
|
void |
setValueTypes(List<ValueType<?>> valueTypes)
|
|
protected String |
toCallString(String moduleName,
boolean function)
|
|
protected String |
toCallString(String moduleName,
Object param,
boolean function)
|
|
|
updateBatch(List<T> entities)
Updates given entities in batch mode. |
|
|
updateBatch(T... entities)
Updates given entities in batch mode. |
|
int |
updateEntity(Object entity)
Updates the given entity. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ConnectionProvider connectionProvider
protected NameConverter nameConverter
protected Dialect dialect
protected SqlExecutor sqlExecutor
protected CallExecutor callExecutor
protected Map<String,Node> nodeCache
protected boolean cacheMode
| Constructor Detail |
|---|
public SqlManagerImpl()
| Method Detail |
|---|
public void setCacheMode(boolean cacheMode)
public void setNameConverter(NameConverter nameConverter)
SqlManagerNameConverter.
setNameConverter in interface SqlManagernameConverter - the name converterpublic NameConverter getNameConverter()
public void setConnectionProvider(ConnectionProvider connectionProvider)
SqlManagerConnectionProvider.
setConnectionProvider in interface SqlManagerconnectionProvider - the connection providerpublic void setEntityCreator(ResultEntityCreator entityCreator)
SqlManagerResultEntityCreator.
setEntityCreator in interface SqlManagerentityCreator - the entity creatorpublic ConnectionProvider getConnectionProvider()
public void setDialect(Dialect dialect)
SqlManagerDialect.
setDialect in interface SqlManagerdialect - the database dialectpublic Dialect getDialect()
protected Node prepareNode(String sqlPath)
protected SqlContext prepareSqlContext(Object param)
public int executeUpdate(String sqlPath)
executeUpdate in interface SqlManager
public int executeUpdate(String sqlPath,
Object param)
executeUpdate in interface SqlManager
public <T> List<T> getResultList(Class<T> clazz,
String sqlPath)
getResultList in interface SqlManager
public <T> List<T> getResultList(Class<T> clazz,
String sqlPath,
Object param)
getResultList in interface SqlManager
public <T> T getSingleResult(Class<T> clazz,
String sqlPath)
getSingleResult in interface SqlManager
public <T> T getSingleResult(Class<T> clazz,
String sqlPath,
Object param)
getSingleResult in interface SqlManagerpublic int deleteEntity(Object entity)
SqlManager
deleteEntity in interface SqlManagerentity - the entity to delete
public <T> int deleteBatch(T... entities)
SqlManager
deleteBatch in interface SqlManagerT - the entity typeentities - entities to delete
public <T> int deleteBatch(List<T> entities)
SqlManager
deleteBatch in interface SqlManagerT - the entity typeentities - entities to delete
public int insertEntity(Object entity)
SqlManager
insertEntity in interface SqlManagerentity - the entity to insert
public <T> int insertBatch(T... entities)
SqlManager
insertBatch in interface SqlManagerT - the entity typeentities - entities to insert
public <T> int insertBatch(List<T> entities)
SqlManager
insertBatch in interface SqlManagerT - the entity typeentities - entities to insert
public int updateEntity(Object entity)
SqlManager
updateEntity in interface SqlManagerentity - the entity to update
public <T> int updateBatch(T... entities)
SqlManager
updateBatch in interface SqlManagerT - the entity typeentities - entities to update
public <T> int updateBatch(List<T> entities)
SqlManager
updateBatch in interface SqlManagerT - the entity typeentities - entities to update
public <T> T findEntity(Class<T> clazz,
Object... id)
SqlManager
findEntity in interface SqlManagerT - the type of entityclazz - the type of entityid - the primary key
null.public void setValueTypes(List<ValueType<?>> valueTypes)
valueTypes -
IllegalArgumentException - if the valueTypes is null or
an element in the valueTypes is nullpublic void addValueType(ValueType<?> valueType)
SqlManagerValueType.
addValueType in interface SqlManagervalueType - the value typepublic int getCount(String sqlPath)
SqlManager
getCount in interface SqlManagersqlPath - the SQL file path
public int getCount(String sqlPath,
Object param)
SqlManager
getCount in interface SqlManagersqlPath - the SQL file pathparam - the parameter object
public int getCountBySql(String sql)
getCountBySql in interface SqlManager
public int getCountBySql(String sql,
Object... params)
getCountBySql in interface SqlManager
public <T,R> R iterate(Class<T> clazz,
IterationCallback<T,R> callback,
String sqlPath)
iterate in interface SqlManager
public <T,R> R iterate(Class<T> clazz,
IterationCallback<T,R> callback,
String sqlPath,
Object param)
iterate in interface SqlManagerpublic void call(String procedureName)
SqlManager
call in interface SqlManagerprocedureName - the procedure name
public void call(String procedureName,
Object parameter)
SqlManager
call in interface SqlManagerprocedureName - the procedure nameparameter - the parameter object
public <T> T call(Class<T> resultClass,
String functionName)
call in interface SqlManager
public <T> T call(Class<T> resultClass,
String functionName,
Object param)
call in interface SqlManager
public <T> List<T> callForList(Class<T> resultClass,
String functionName)
callForList in interface SqlManager
public <T> List<T> callForList(Class<T> resultClass,
String functionName,
Object param)
callForList in interface SqlManager
protected String toCallString(String moduleName,
boolean function)
protected String toCallString(String moduleName,
Object param,
boolean function)
protected boolean needsParameter(PropertyDesc pd)
public <T> List<T> getResultListBySql(Class<T> clazz,
String sql)
getResultListBySql in interface SqlManager
public <T> List<T> getResultListBySql(Class<T> clazz,
String sql,
Object... params)
getResultListBySql in interface SqlManager
public <T> T getSingleResultBySql(Class<T> clazz,
String sql)
getSingleResultBySql in interface SqlManager
public <T> T getSingleResultBySql(Class<T> clazz,
String sql,
Object... params)
getSingleResultBySql in interface SqlManager
public <T,R> R iterateBySql(Class<T> clazz,
IterationCallback<T,R> callback,
String sql)
iterateBySql in interface SqlManager
public <T,R> R iterateBySql(Class<T> clazz,
IterationCallback<T,R> callback,
String sql,
Object... params)
iterateBySql in interface SqlManagerpublic int executeUpdateBySql(String sql)
SqlManager
int rows = sqlManager.executeUpdateBySql("DELETE FROM EMPLOYEE");
executeUpdateBySql in interface SqlManagersql - the SQL to execute
public int executeUpdateBySql(String sql,
Object... params)
SqlManager
int rows = sqlManager.executeUpdateBySql("DELETE FROM EMPLOYEE WHERE ID=?", id);
executeUpdateBySql in interface SqlManagersql - the SQL to execute which contains placeholder (This is not a 2waySQL)params - the parameters which are set to the placeholder
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||