|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jpattern.orm.session.OrmSession
public class OrmSession
| Constructor Summary | |
|---|---|
OrmSession(IOrmClassToolMap ormClassToolMap,
SessionStrategy sessionStrategy,
TypeFactory typeFactory,
Validator validator)
|
|
| Method Summary | ||
|---|---|---|
|
delete(List<T> objects)
Delete the objects from the database |
|
|
delete(T object)
Delete one object from the database |
|
DeleteQuery |
deleteQuery(Class<?> clazz)
Delete the objects of a specific table |
|
DeleteQuery |
deleteQuery(Class<?> clazz,
String alias)
Delete the objects of a specific table |
|
|
doInTransaction(TransactionCallback<T> transactionCallback)
Execute a block of code inside a Transaction or participate to an existing one |
|
|
doInTransaction(TransactionDefinition transactionDefinition,
TransactionCallback<T> transactionCallback)
Execute a block of code inside a Transaction or participate to an existing one |
|
|
exist(Class<T> clazz,
Object value)
Return whether a Bean with a specific id exists in the DB. |
|
|
exist(Class<T> clazz,
Object[] values)
Return whether a Bean with the specific ids exists in the DB. |
|
|
exist(T object)
Return whether a Bean exist in the DB using the Object type and id(s). |
|
|
find(Class<T> clazz,
Object value)
Find a bean using is ID. |
|
|
find(Class<T> clazz,
Object[] values)
Find a bean using is IDs. |
|
|
findQuery(Class<T> clazz)
Create a new query |
|
|
findQuery(Class<T> clazz,
String alias)
Create a new query |
|
CustomFindQuery |
findQuery(String selectClause,
Class<?> clazz,
String alias)
Create a new query |
|
|
findUnique(Class<T> clazz,
Object value)
Find a bean using is ID. |
|
|
findUnique(Class<T> clazz,
Object[] values)
Find a bean using is IDs. |
|
IOrmClassToolMap |
getOrmClassToolMap()
|
|
|
save(Collection<T> objects)
Persist the new objects in the database |
|
|
save(T object)
Persist the new object in the database |
|
|
saveOrUpdate(Collection<T> objects)
For each object in the list, update the object if it exists, otherwise save it |
|
|
saveOrUpdate(T object)
Update the object if it exists, otherwise save it |
|
ScriptExecutor |
scriptExecutor()
A script executor useful to execute multiple sql statement from files. |
|
SqlExecutor |
sqlExecutor()
An executor to perform any kind of plain SQL statements. |
|
SqlPerformer |
sqlPerformer()
Return an executor to perform plain sql queries. |
|
Transaction |
transaction()
Begin a transaction or participate to an existing one using the default ITransactionDefinition |
|
Transaction |
transaction(TransactionDefinition transactionDefinition)
Begin a or participate to an existing one depending on the specific transactionDefinition |
|
|
update(Collection<T> objects)
Update the values of the existing objects in the database |
|
|
update(T object)
Update the values of an existing object in the database |
|
UpdateQuery |
updateQuery(Class<?> clazz)
Update the objects of a specific TABLE |
|
UpdateQuery |
updateQuery(Class<?> clazz,
String alias)
Update the objects of a specific TABLE |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OrmSession(IOrmClassToolMap ormClassToolMap,
SessionStrategy sessionStrategy,
TypeFactory typeFactory,
Validator validator)
| Method Detail |
|---|
public final <T> FindQuery<T> findQuery(Class<T> clazz)
throws OrmException
Session
findQuery in interface Sessionclazz - The class of the object that will be retrieved by the query execution. The simple class name will be used as alias for the class
OrmException
public final <T> FindQuery<T> findQuery(Class<T> clazz,
String alias)
throws OrmException
Session
findQuery in interface Sessionclazz - The class of the object that will be retrieved by the query execution.alias - The alias of the class in the query.
OrmException
public final CustomFindQuery findQuery(String selectClause,
Class<?> clazz,
String alias)
throws OrmException
Session
findQuery in interface SessionselectClause - the select clause of the query (do not use the "select" keyword)clazz - The class of the object that will be retrieved by the query execution.alias - The alias of the class in the query.
OrmExceptionpublic final IOrmClassToolMap getOrmClassToolMap()
public <T> boolean exist(T object)
throws OrmException
Session
exist in interface SessionOrmException
public <T> boolean exist(Class<T> clazz,
Object value)
throws OrmException
Session
exist in interface Sessionclazz - The Class of the object to loadvalue - the value of the identifying column of the object
OrmException
public <T> boolean exist(Class<T> clazz,
Object[] values)
throws OrmException
Session
exist in interface Sessionclazz - The Class of the object to loadvalues - an ordered array with the values of the identifying columns of the object
OrmException
public final <T> T find(Class<T> clazz,
Object value)
throws OrmException
Session
find in interface Sessionclazz - The Class of the object to loadvalue - the value of the identifying column of the object
OrmException
public final <T> T find(Class<T> clazz,
Object[] values)
throws OrmException
Session
find in interface Sessionclazz - The Class of the object to loadvalues - an ordered array with the values of the identifying columns of the object
OrmException
public final <T> T findUnique(Class<T> clazz,
Object value)
throws OrmException,
OrmNotUniqueResultException
Session
findUnique in interface Sessionclazz - The Class of the object to loadvalue - the value of the identifying column of the object
OrmException
OrmNotUniqueResultException
public final <T> T findUnique(Class<T> clazz,
Object[] values)
throws OrmException,
OrmNotUniqueResultException
Session
findUnique in interface Sessionclazz - The Class of the object to loadvalues - an ordered array with the values of the identifying columns of the object
OrmException
OrmNotUniqueResultException
public final <T> T save(T object)
throws OrmException
Session
save in interface SessionOrmException
public final <T> T update(T object)
throws OrmException
Session
update in interface SessionOrmException
public final UpdateQuery updateQuery(Class<?> clazz)
throws OrmException
Session
updateQuery in interface Sessionclazz - the TABLE related Class
OrmException
public final UpdateQuery updateQuery(Class<?> clazz,
String alias)
throws OrmException
Session
updateQuery in interface Sessionclazz - the TABLE related Classalias - The alias of the class in the query.
OrmException
public final <T> int delete(T object)
throws OrmException
Session
delete in interface SessionOrmException
public final <T> int delete(List<T> objects)
throws OrmException
Session
delete in interface SessionOrmException
public final DeleteQuery deleteQuery(Class<?> clazz)
throws OrmException
Session
deleteQuery in interface Sessionclazz - the TABLE related Class
OrmException
public final DeleteQuery deleteQuery(Class<?> clazz,
String alias)
throws OrmException
Session
deleteQuery in interface Sessionclazz - the TABLE related Classalias - The alias of the class in the query.
OrmException
public final ScriptExecutor scriptExecutor()
throws OrmException
Session
scriptExecutor in interface SessionOrmExceptionpublic final SqlExecutor sqlExecutor()
Session
sqlExecutor in interface Session
public final Transaction transaction()
throws OrmException
Session
transaction in interface SessionOrmException
public Transaction transaction(TransactionDefinition transactionDefinition)
throws OrmException
Session
transaction in interface SessionOrmException
public <T> T doInTransaction(TransactionCallback<T> transactionCallback)
throws OrmException
Session
doInTransaction in interface SessionOrmException
public <T> T doInTransaction(TransactionDefinition transactionDefinition,
TransactionCallback<T> transactionCallback)
throws OrmException
Session
doInTransaction in interface SessionOrmException
public SqlPerformer sqlPerformer()
throws OrmException
SessionSqlPerformer
sqlPerformer in interface SessionSqlPerformerOrmException
public <T> T saveOrUpdate(T object)
throws OrmException
Session
saveOrUpdate in interface SessionOrmException
public <T> List<T> save(Collection<T> objects)
throws OrmException
Session
save in interface Sessionobjects - the objects to persist
OrmException
public <T> List<T> saveOrUpdate(Collection<T> objects)
throws OrmException
Session
saveOrUpdate in interface Sessionobjects - the objects to persist
OrmException
public <T> List<T> update(Collection<T> objects)
throws OrmException
Session
update in interface Sessionobjects - the objects to update
OrmException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||