Package org.sqlproc.engine.hibernate
Class HibernateQuery
- java.lang.Object
-
- org.sqlproc.engine.hibernate.HibernateQuery
-
- All Implemented Interfaces:
SqlQuery
public class HibernateQuery extends Object implements SqlQuery
The Hibernate stack implementation of the SQL Engine query contract. In fact it's an adapter the internal Hibernate stuff.For more info please see the Tutorials.
- Author:
- Vladimir Hudec
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classHibernateQuery.BatchResultHolder-
Nested classes/interfaces inherited from interface org.sqlproc.engine.SqlQuery
SqlQuery.SqlQueryRowProcessor
-
-
Field Summary
Fields Modifier and Type Field Description (package private) List<String>identitiesThe collection of all (auto-generated) identities.(package private) Map<String,IdentitySetter>identitySettersThe collection of all identities setters.(package private) Map<String,Object>identityTypesThe collection of all identities types.(package private) booleanlogErrorThe failed SQL command should be logged.(package private) org.slf4j.LoggerloggerThe internal slf4j logger.(package private) org.hibernate.SQLQueryqueryThe Hibernate SQLQuery instance.(package private) org.hibernate.SessionsessionThe Hibernate Session instance.
-
Constructor Summary
Constructors Constructor Description HibernateQuery(org.hibernate.Session session, org.hibernate.SQLQuery query)Creates a new instance of this adapter.
-
Method Summary
-
-
-
Field Detail
-
logger
final org.slf4j.Logger logger
The internal slf4j logger.
-
session
org.hibernate.Session session
The Hibernate Session instance.
-
query
org.hibernate.SQLQuery query
The Hibernate SQLQuery instance.
-
identitySetters
Map<String,IdentitySetter> identitySetters
The collection of all identities setters.
-
logError
boolean logError
The failed SQL command should be logged.
-
-
Method Detail
-
setSqlControl
public SqlQuery setSqlControl(SqlControl sqlControl)
- Specified by:
setSqlControlin interfaceSqlQuery
-
setOrdered
public SqlQuery setOrdered(boolean ordered)
- Specified by:
setOrderedin interfaceSqlQuery
-
list
public List<Map<String,Object>> list(SqlRuntimeContext runtime) throws SqlProcessorException
- Specified by:
listin interfaceSqlQuery- Throws:
SqlProcessorException
-
query
public int query(SqlRuntimeContext runtimeCtx, SqlQuery.SqlQueryRowProcessor sqlQueryRowProcessor) throws SqlProcessorException
- Specified by:
queryin interfaceSqlQuery- Throws:
SqlProcessorException
-
unique
public Map<String,Object> unique(SqlRuntimeContext runtime) throws SqlProcessorException
- Specified by:
uniquein interfaceSqlQuery- Throws:
SqlProcessorException
-
update
public int update(SqlRuntimeContext runtime) throws SqlProcessorException
- Specified by:
updatein interfaceSqlQuery- Throws:
SqlProcessorException
-
isSetJDBCIdentity
private boolean isSetJDBCIdentity()
-
doIdentitySelect
private void doIdentitySelect(String identityName)
Runs the select to obtain the value of auto-generated identity.- Parameters:
identityName- the identity name from the META SQL statement
-
setParameter
public SqlQuery setParameter(String name, Object val) throws SqlProcessorException
- Specified by:
setParameterin interfaceSqlQuery- Throws:
SqlProcessorException
-
setParameter
public SqlQuery setParameter(String name, Object val, Object type, Class<?>... moreTypes) throws SqlProcessorException
- Specified by:
setParameterin interfaceSqlQuery- Throws:
SqlProcessorException
-
setParameterList
public SqlQuery setParameterList(String name, Object[] vals) throws SqlProcessorException
- Specified by:
setParameterListin interfaceSqlQuery- Throws:
SqlProcessorException
-
setParameterList
public SqlQuery setParameterList(String name, Object[] vals, Object type, Class<?>... moreTypes) throws SqlProcessorException
- Specified by:
setParameterListin interfaceSqlQuery- Throws:
SqlProcessorException
-
callList
public List<Map<String,Object>> callList(SqlRuntimeContext runtime) throws SqlProcessorException
- Specified by:
callListin interfaceSqlQuery- Throws:
SqlProcessorException
-
callUnique
public Map<String,Object> callUnique(SqlRuntimeContext runtime) throws SqlProcessorException
- Specified by:
callUniquein interfaceSqlQuery- Throws:
SqlProcessorException
-
callUpdate
public int callUpdate(SqlRuntimeContext runtime) throws SqlProcessorException
- Specified by:
callUpdatein interfaceSqlQuery- Throws:
SqlProcessorException
-
callFunction
public Map<String,Object> callFunction() throws SqlProcessorException
- Specified by:
callFunctionin interfaceSqlQuery- Throws:
SqlProcessorException
-
executeBatch
public int[] executeBatch(String[] statements) throws SqlProcessorException
- Specified by:
executeBatchin interfaceSqlQuery- Throws:
SqlProcessorException
-
newSqlProcessorException
protected SqlProcessorException newSqlProcessorException(org.hibernate.HibernateException ex, String query)
-
setLogError
public void setLogError(boolean logError)
Sets an indicator the failed SQL command should be logged- Specified by:
setLogErrorin interfaceSqlQuery- Parameters:
logError- an indicator the failed SQL command should be logged
-
-