org.sqlproc.engine.hibernate
Class HibernateQuery

java.lang.Object
  extended by 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 Reference Guide or the tutorials.

Author:
Vladimir Hudec

Field Summary
(package private)  List<String> identities
          The collection of all (auto-generated) identities.
(package private)  Map<String,IdentitySetter> identitySetters
          The collection of all identities setters.
(package private)  Map<String,Object> identityTypes
          The collection of all identities types.
(package private)  org.hibernate.SQLQuery query
          The Hibernate SQLQuery instance.
(package private)  org.hibernate.Session session
          The Hibernate Session instance.
 
Constructor Summary
HibernateQuery(org.hibernate.Session session, org.hibernate.SQLQuery query)
          Creates a new instance of this adapter.
 
Method Summary
 SqlQuery addScalar(String columnAlias)
          
 SqlQuery addScalar(String columnAlias, Object type)
          
private  void doIdentitySelect(String identityName)
          Runs the select to obtain the value of auto-generated identity.
 int executeUpdate()
          
 Object getQuery()
          
 List list()
          
 SqlQuery setFirstResult(int firstResult)
          
 SqlQuery setMaxResults(int maxResults)
          
 SqlQuery setParameter(String name, Object val)
          
 SqlQuery setParameter(String name, Object val, Object type)
          
 SqlQuery setParameterList(String name, Object[] vals)
          
 SqlQuery setParameterList(String name, Object[] vals, Object type)
          
 SqlQuery setTimeout(int timeout)
          
 Object uniqueResult()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

org.hibernate.Session session
The Hibernate Session instance.


query

org.hibernate.SQLQuery query
The Hibernate SQLQuery instance.


identities

List<String> identities
The collection of all (auto-generated) identities.


identitySetters

Map<String,IdentitySetter> identitySetters
The collection of all identities setters.


identityTypes

Map<String,Object> identityTypes
The collection of all identities types.

Constructor Detail

HibernateQuery

public HibernateQuery(org.hibernate.Session session,
                      org.hibernate.SQLQuery query)
Creates a new instance of this adapter.

Parameters:
session - the Hibernate Session instance
query - the Hibernate SQLQuery instance
Method Detail

getQuery

public Object getQuery()

Specified by:
getQuery in interface SqlQuery

setTimeout

public SqlQuery setTimeout(int timeout)

Specified by:
setTimeout in interface SqlQuery

setFirstResult

public SqlQuery setFirstResult(int firstResult)

Specified by:
setFirstResult in interface SqlQuery

setMaxResults

public SqlQuery setMaxResults(int maxResults)

Specified by:
setMaxResults in interface SqlQuery

list

public List list()
          throws SqlProcessorException

Specified by:
list in interface SqlQuery
Throws:
SqlProcessorException

uniqueResult

public Object uniqueResult()
                    throws SqlProcessorException

Specified by:
uniqueResult in interface SqlQuery
Throws:
SqlProcessorException

executeUpdate

public int executeUpdate()
                  throws SqlProcessorException

Specified by:
executeUpdate in interface SqlQuery
Throws:
SqlProcessorException

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

addScalar

public SqlQuery addScalar(String columnAlias)

Specified by:
addScalar in interface SqlQuery

addScalar

public SqlQuery addScalar(String columnAlias,
                          Object type)

Specified by:
addScalar in interface SqlQuery

setParameter

public SqlQuery setParameter(String name,
                             Object val)
                      throws SqlProcessorException

Specified by:
setParameter in interface SqlQuery
Throws:
SqlProcessorException

setParameter

public SqlQuery setParameter(String name,
                             Object val,
                             Object type)
                      throws SqlProcessorException

Specified by:
setParameter in interface SqlQuery
Throws:
SqlProcessorException

setParameterList

public SqlQuery setParameterList(String name,
                                 Object[] vals)
                          throws SqlProcessorException

Specified by:
setParameterList in interface SqlQuery
Throws:
SqlProcessorException

setParameterList

public SqlQuery setParameterList(String name,
                                 Object[] vals,
                                 Object type)
                          throws SqlProcessorException

Specified by:
setParameterList in interface SqlQuery
Throws:
SqlProcessorException


Copyright © 2011. All Rights Reserved.