org.compass.gps.device.hibernate
Class DefaultHibernateQueryProvider

java.lang.Object
  extended by org.compass.gps.device.hibernate.DefaultHibernateQueryProvider
All Implemented Interfaces:
HibernateQueryProvider

public class DefaultHibernateQueryProvider
extends Object
implements HibernateQueryProvider

A simple Hibernate query provider based on a select statement. The select statement can be automatically generated based on the entity name as well.

Author:
kimchy

Constructor Summary
DefaultHibernateQueryProvider(Class entityClass, String entityName)
          Creates a new query provider based on the entity name.
DefaultHibernateQueryProvider(String selectQuery)
          Creates a new query provider based on the provided select statement.
 
Method Summary
 Criteria createCriteria(Session session, EntityInformation entityInformation)
          Creates the Hibernate criteria for the given entity information.
 Query createQuery(Session session, EntityInformation entityInformation)
          Creates a query based on the select statement initlaized in the query provider construction.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultHibernateQueryProvider

public DefaultHibernateQueryProvider(Class entityClass,
                                     String entityName)
Creates a new query provider based on the entity name. The select statement is from entityName.

Parameters:
entityClass - The entity class
entityName - The entity name

DefaultHibernateQueryProvider

public DefaultHibernateQueryProvider(String selectQuery)
Creates a new query provider based on the provided select statement.

Parameters:
selectQuery - The select query
Method Detail

createQuery

public Query createQuery(Session session,
                         EntityInformation entityInformation)
Creates a query based on the select statement initlaized in the query provider construction.

Specified by:
createQuery in interface HibernateQueryProvider
Parameters:
session - The Hibernate session to create the query with
entityInformation - The enity information to create the query with
Returns:
the Hibernate query

createCriteria

public Criteria createCriteria(Session session,
                               EntityInformation entityInformation)
Creates the Hibernate criteria for the given entity information. Returns null if the select query is set.

Specified by:
createCriteria in interface HibernateQueryProvider
Parameters:
session - The Hibernate session to create the query with
entityInformation - The enity information to create the query with
Returns:
the Hibernate query

toString

public String toString()
Overrides:
toString in class Object


Copyright (c) 2004-2009 The Compass Project.