org.azzyzt.jee.runtime.util
Class QueryBuilder<ID,T extends EntityBase<ID>>

java.lang.Object
  extended by org.azzyzt.jee.runtime.util.QueryBuilder<ID,T>
Type Parameters:
ID - Type of the ID of the entity class of the query result
T - Type of the entity class or the query result

public class QueryBuilder<ID,T extends EntityBase<ID>>
extends java.lang.Object

Uses a JPA criteria builder to create a typed query equivalent to a QuerySpec. While building, the query is validated against type meta information generated by Azzyzt JEE Tools, in order to make sure that only existing and mapped associations can be followed.

See Also:
QuerySpec, EntityBase

Constructor Summary
QueryBuilder(javax.persistence.EntityManager em, QuerySpec qs, java.lang.Class<T> clazz, TypeMetaInfoInterface tmi)
           
 
Method Summary
 javax.persistence.TypedQuery<T> build()
          builds the typed query
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryBuilder

public QueryBuilder(javax.persistence.EntityManager em,
                    QuerySpec qs,
                    java.lang.Class<T> clazz,
                    TypeMetaInfoInterface tmi)
Parameters:
em - a JPA EntityManager
qs - a query specification
clazz - the class of the resulting entities
tmi - type meta information generated by Azzyzt JEE Tools
Method Detail

build

public javax.persistence.TypedQuery<T> build()
                                                             throws InvalidFieldException,
                                                                    AccessDeniedException,
                                                                    QuerySyntaxException,
                                                                    NotYetImplementedException
builds the typed query

Returns:
A JPA typed query
Throws:
InvalidFieldException
AccessDeniedException
QuerySyntaxException
NotYetImplementedException