|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.jpa.JpaQuery
public class JpaQuery
A JPA Query that wraps a Cayenne Query.
Field Summary | |
---|---|
protected Query |
cayenneQuery
|
protected ObjectContext |
context
|
protected Map<String,Object> |
parameters
|
Constructor Summary | |
---|---|
JpaQuery(ObjectContext ctxt)
|
|
JpaQuery(ObjectContext context,
String name)
Construct a named query. |
Method Summary | |
---|---|
int |
executeUpdate()
Execute an update or delete statement. |
protected Query |
getQuery()
|
List |
getResultList()
Execute a SELECT query and return the query results as a List. |
Object |
getSingleResult()
Execute a SELECT query that returns a single result. |
Query |
setFirstResult(int startPosition)
Set the position of the first result to retrieve. |
Query |
setFlushMode(FlushModeType flushModeType)
|
Query |
setHint(String hintName,
Object value)
Set an implementation-specific hint. |
Query |
setMaxResults(int maxResult)
Set the maximum number of results to retrieve. |
Query |
setParameter(int position,
Calendar value,
TemporalType temporalType)
Bind an instance of java.util.Calendar to a positional parameter. |
Query |
setParameter(int position,
Date value,
TemporalType temporalType)
Bind an instance of java.util.Date to a positional parameter. |
Query |
setParameter(int position,
Object value)
Bind an argument to a positional parameter. |
Query |
setParameter(String name,
Calendar value,
TemporalType temporalType)
Bind an instance of java.util.Calendar to a named parameter. |
Query |
setParameter(String name,
Date value,
TemporalType temporalType)
Bind an instance of java.util.Date to a named parameter. |
Query |
setParameter(String name,
Object value)
Bind an argument to a named parameter. |
protected void |
setQuery(Query q)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map<String,Object> parameters
protected Query cayenneQuery
protected ObjectContext context
Constructor Detail |
---|
public JpaQuery(ObjectContext ctxt)
public JpaQuery(ObjectContext context, String name)
Method Detail |
---|
protected void setQuery(Query q)
protected Query getQuery()
public List getResultList()
IllegalStateException
- if called for an EJB QL UPDATE or DELETE statementpublic int executeUpdate()
IllegalStateException
- if called for an EJB QL SELECT statement
TransactionRequiredException
- if there is no transactionpublic Object getSingleResult()
NoResultException
- if there is no result
NonUniqueResultException
- if more than one result
IllegalStateException
- if called for an EJB QL UPDATE or DELETE statementpublic Query setMaxResults(int maxResult)
maxResult
-
IllegalArgumentException
- if argument is negativepublic Query setFlushMode(FlushModeType flushModeType)
public Query setHint(String hintName, Object value)
hintName
- value
-
IllegalArgumentException
- if the second argument is not valid for the
implementationpublic Query setFirstResult(int startPosition)
startPosition
- position of the first result, numbered from 0
IllegalArgumentException
- if argument is negativepublic Query setParameter(String name, Object value)
name
- the parameter namevalue
-
IllegalArgumentException
- if parameter name does not correspond to parameter
in query string or argument is of incorrect typepublic Query setParameter(String name, Date value, TemporalType temporalType)
name
- value
- temporalType
-
IllegalArgumentException
- if parameter name does not correspond to parameter
in query stringpublic Query setParameter(String name, Calendar value, TemporalType temporalType)
name
- value
- temporalType
-
IllegalArgumentException
- if parameter name does not correspond to parameter
in query stringpublic Query setParameter(int position, Object value)
position
- value
-
IllegalArgumentException
- if position does not correspond to positional
parameter of query or argument is of incorrect typepublic Query setParameter(int position, Date value, TemporalType temporalType)
position
- value
- temporalType
-
IllegalArgumentException
- if position does not correspond to positional
parameter of querypublic Query setParameter(int position, Calendar value, TemporalType temporalType)
position
- value
- temporalType
-
IllegalArgumentException
- if position does not correspond to positional
parameter of query
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |