org.apache.cayenne.jpa
Class JpaNativeQuery

java.lang.Object
  extended by org.apache.cayenne.jpa.JpaQuery
      extended by org.apache.cayenne.jpa.JpaNativeQuery
All Implemented Interfaces:
javax.persistence.Query

public class JpaNativeQuery
extends JpaQuery

A JPA wrapper for Cayenne SQLTemplate.

Since:
3.0
Author:
Andrus Adamchik

Field Summary
protected  Map<String,Object> parameters
           
protected  SQLTemplate query
           
 
Fields inherited from class org.apache.cayenne.jpa.JpaQuery
context
 
Constructor Summary
JpaNativeQuery(ObjectContext context, String sqlString, Class<?> resultClass)
           
JpaNativeQuery(ObjectContext context, String sqlString, String dataMapName)
           
 
Method Summary
protected  Query getQuery()
           
protected  String processSQLString(String sqlString)
           
 javax.persistence.Query setParameter(int position, Object value)
          Bind an argument to a positional parameter.
 javax.persistence.Query setParameter(String name, Object value)
          Bind an argument to a named parameter.
 
Methods inherited from class org.apache.cayenne.jpa.JpaQuery
executeUpdate, getResultList, getSingleResult, setFirstResult, setFlushMode, setHint, setMaxResults, setParameter, setParameter, setParameter, setParameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

query

protected SQLTemplate query

parameters

protected Map<String,Object> parameters
Constructor Detail

JpaNativeQuery

public JpaNativeQuery(ObjectContext context,
                      String sqlString,
                      Class<?> resultClass)

JpaNativeQuery

public JpaNativeQuery(ObjectContext context,
                      String sqlString,
                      String dataMapName)
Method Detail

processSQLString

protected String processSQLString(String sqlString)

getQuery

protected Query getQuery()
Specified by:
getQuery in class JpaQuery

setParameter

public javax.persistence.Query setParameter(String name,
                                            Object value)
Description copied from class: JpaQuery
Bind an argument to a named parameter.

Specified by:
setParameter in interface javax.persistence.Query
Specified by:
setParameter in class JpaQuery
Parameters:
name - the parameter name
Returns:
the same query instance

setParameter

public javax.persistence.Query setParameter(int position,
                                            Object value)
Bind an argument to a positional parameter.

Specified by:
setParameter in interface javax.persistence.Query
Specified by:
setParameter in class JpaQuery
Parameters:
position -
value -
Returns:
the same query instance
Throws:
IllegalArgumentException - if position does not correspond to positional parameter of query or argument is of incorrect type


Copyright © 2001-2008 Apache Cayenne. All Rights Reserved.