org.compass.gps.device.jpa.queryprovider
Class DefaultJpaQueryProvider

java.lang.Object
  extended by org.compass.gps.device.jpa.queryprovider.DefaultJpaQueryProvider
All Implemented Interfaces:
JpaQueryProvider
Direct Known Subclasses:
HibernateJpaQueryProvider

public class DefaultJpaQueryProvider
extends Object
implements JpaQueryProvider

A simple Jpa 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
DefaultJpaQueryProvider(Class<?> entityClass, String entityName)
          Creates a new query provider based on the entity name.
DefaultJpaQueryProvider(String selectQuery)
          Creates a new query provider based on the provided select statement.
 
Method Summary
 javax.persistence.Query createQuery(javax.persistence.EntityManager entityManager, EntityInformation entityInformation)
          Creates a query based on the select statement initlaized in the query provider construction.
protected  boolean isUsingDefaultSelectQuery()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultJpaQueryProvider

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

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

DefaultJpaQueryProvider

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

Parameters:
selectQuery - The select query
Method Detail

createQuery

public javax.persistence.Query createQuery(javax.persistence.EntityManager entityManager,
                                           EntityInformation entityInformation)
Creates a query based on the select statement initlaized in the query provider construction.

Specified by:
createQuery in interface JpaQueryProvider
Parameters:
entityManager - The entity manager to create the query with
entityInformation - The enity information to create the query with
Returns:
the Jpa query

isUsingDefaultSelectQuery

protected boolean isUsingDefaultSelectQuery()

toString

public String toString()
Overrides:
toString in class Object


Copyright (c) 2004-2008 The Compass Project.