org.apache.camel.component.jpa
Class QueryBuilder

java.lang.Object
  extended by org.apache.camel.component.jpa.QueryBuilder
All Implemented Interfaces:
QueryFactory

public abstract class QueryBuilder
extends Object
implements QueryFactory

A builder of query expressions

Version:
$Revision: 15829 $

Nested Class Summary
protected static class QueryBuilder.ParameterBuilder
          A plugin strategy to populate the query with parameters
 
Constructor Summary
QueryBuilder()
           
 
Method Summary
protected  void checkNoParametersConfigured()
           
 Query createQuery(EntityManager entityManager)
          Creates a new query to find objects to be processed
protected  String getParameterDescription()
           
protected abstract  Query makeQueryObject(EntityManager entityManager)
           
static QueryBuilder namedQuery(String namedQuery)
          Creates a named query
static QueryBuilder nativeQuery(String nativeQuery)
          Creates a native SQL query
 QueryBuilder parameters(Collection parameters)
          Specifies the parameters to the query as an ordered collection of parameters
 QueryBuilder parameters(Map<String,Object> parameterMap)
          Specifies the parameters to the query as a Map of key/value pairs
 QueryBuilder parameters(Object... parameters)
          Specifies the parameters to the query
protected  void populateQuery(EntityManager entityManager, Query query)
           
static QueryBuilder query(String query)
          Creates a query builder using the JPA query syntax
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryBuilder

public QueryBuilder()
Method Detail

query

public static QueryBuilder query(String query)
Creates a query builder using the JPA query syntax

Parameters:
query - JPA query language to create
Returns:
a query builder

namedQuery

public static QueryBuilder namedQuery(String namedQuery)
Creates a named query


nativeQuery

public static QueryBuilder nativeQuery(String nativeQuery)
Creates a native SQL query


parameters

public QueryBuilder parameters(Object... parameters)
Specifies the parameters to the query

Parameters:
parameters - the parameters to be configured on the query
Returns:
this query builder

parameters

public QueryBuilder parameters(Collection parameters)
Specifies the parameters to the query as an ordered collection of parameters

Parameters:
parameters - the parameters to be configured on the query
Returns:
this query builder

parameters

public QueryBuilder parameters(Map<String,Object> parameterMap)
Specifies the parameters to the query as a Map of key/value pairs

Parameters:
parameterMap - the parameters to be configured on the query
Returns:
this query builder

checkNoParametersConfigured

protected void checkNoParametersConfigured()

createQuery

public Query createQuery(EntityManager entityManager)
Description copied from interface: QueryFactory
Creates a new query to find objects to be processed

Specified by:
createQuery in interface QueryFactory
Returns:
the query configured with any parameters etc

getParameterDescription

protected String getParameterDescription()

populateQuery

protected void populateQuery(EntityManager entityManager,
                             Query query)

makeQueryObject

protected abstract Query makeQueryObject(EntityManager entityManager)


Copyright © 2007-2010 IONA Open Source Community. All Rights Reserved.