T - the entity typepublic class PersistenceManager<T> extends Object
| Constructor and Description |
|---|
PersistenceManager() |
| Modifier and Type | Method and Description |
|---|---|
int |
delete(Connection connection,
Class<T> clazz,
Object id)
Delete a single record representing a single POJO instance.
|
int |
execute(Connection connection,
String sql,
List<Object> values)
Custom update statement.
|
int |
execute(Connection connection,
String sql,
Object... values)
Custom update statement.
|
T |
find(Connection connection,
Class<T> clazz,
Object id)
Getter for the single POJO instance.
|
List<T> |
findAll(Connection connection,
Class<T> clazz)
Getter for all the POJO instances.
|
IEntityManagerInterceptor |
getEntityManagerInterceptor()
Gets the entity manager interceptor.
|
Object |
insert(Connection connection,
T pojo)
Insert a single record in the table representing the POJO instance.
|
T |
lock(Connection connection,
Class<T> clazz,
Object id)
Getter for the single POJO instance and locks it for update.
|
List<T> |
query(Connection connection,
Class<T> clazz,
String sql,
List<Object> values)
Custom query for narrow the search.
|
List<T> |
query(Connection connection,
Class<T> clazz,
String sql,
Object... values)
Custom query for narrow the search.
|
void |
reset()
Clean up the existing tables cache.
|
void |
reset(Connection connection,
Class<T> clazz) |
void |
setEntityManagerInterceptor(IEntityManagerInterceptor entityManagerInterceptor)
Sets the entity manager interceptor.
|
void |
tableCheck(Connection connection,
Class clazz)
Check whether the table already exists in the database and create it if needed.
|
int |
tableCreate(Connection connection,
Class<T> clazz)
Create a table by a provided Class.
|
int |
tableDrop(Connection connection,
Class<T> clazz)
Drop a table by a provided Class.
|
boolean |
tableExists(Connection connection,
Class<T> clazz)
Check whether a table by a provided Class already exists.
|
int |
update(Connection connection,
T pojo)
Update.
|
public int tableCreate(Connection connection, Class<T> clazz)
connection - the database connectionclazz - the POJO's Classpublic int tableDrop(Connection connection, Class<T> clazz)
connection - the database connectionclazz - the POJO's Classpublic boolean tableExists(Connection connection, Class<T> clazz)
connection - the database connectionclazz - the POJO's Classpublic void tableCheck(Connection connection, Class clazz)
connection - the database connectionclazz - the clazzpublic void reset()
public void reset(Connection connection, Class<T> clazz)
public Object insert(Connection connection, T pojo)
connection - the database connectionpojo - the POJO instancepublic T find(Connection connection, Class<T> clazz, Object id)
connection - the database connectionclazz - the POJO's Classid - the primary key field's valuepublic T lock(Connection connection, Class<T> clazz, Object id)
connection - the database connectionclazz - the POJO's Classid - the primary key field's valuepublic List<T> findAll(Connection connection, Class<T> clazz)
connection - the database connectionclazz - the POJO's Classpublic List<T> query(Connection connection, Class<T> clazz, String sql, List<Object> values)
connection - the database connectionclazz - the POJO's Classsql - the custom SQL scriptvalues - ordered parameters valuespublic List<T> query(Connection connection, Class<T> clazz, String sql, Object... values)
connection - the database connectionclazz - the POJO's Classsql - the custom SQL scriptvalues - ordered parameters valuespublic int execute(Connection connection, String sql, List<Object> values)
connection - the database connectionsql - the custom SQL scriptvalues - ordered parameters valuespublic int execute(Connection connection, String sql, Object... values)
connection - the database connectionsql - the custom SQL scriptvalues - ordered parameters valuespublic int delete(Connection connection, Class<T> clazz, Object id)
connection - the database connectionclazz - the POJO's Classid - the primary key field's valuepublic int update(Connection connection, T pojo)
connection - the database connectionpojo - the POJO instancepublic IEntityManagerInterceptor getEntityManagerInterceptor()
public void setEntityManagerInterceptor(IEntityManagerInterceptor entityManagerInterceptor)
entityManagerInterceptor - the new entity manager interceptorCopyright © 2010–2018 Eclipse Foundation. All rights reserved.