public interface Query
Modifier and Type | Method and Description |
---|---|
int |
executeUpdate()
Execute an update or delete statement.
|
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 flushMode)
Set the flush mode type to be used for the query execution.
|
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.
|
List getResultList()
IllegalStateException
- if called for a Java
Persistence query language UPDATE or DELETE statementObject getSingleResult()
EntityNotFoundException
- if there is no resultNonUniqueResultException
- if more than one resultIllegalStateException
- if called for a Java
Persistence query language UPDATE or DELETE statementint executeUpdate()
IllegalStateException
- if called for a Java
Persistence query language SELECT statementTransactionRequiredException
- if there is
no transactionQuery setMaxResults(int maxResult)
maxResult
- IllegalArgumentException
- if argument is negativeQuery setFirstResult(int startPosition)
startPosition
- the start position of the first result, numbered from 0IllegalArgumentException
- if argument is negativeQuery setHint(String hintName, Object value)
hintName
- value
- IllegalArgumentException
- if the second argument is not
valid for the implementationQuery 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 typeQuery setParameter(String name, Date value, TemporalType temporalType)
name
- value
- temporalType
- IllegalArgumentException
- if parameter name does not
correspond to parameter in query stringQuery setParameter(String name, Calendar value, TemporalType temporalType)
name
- value
- temporalType
- IllegalArgumentException
- if parameter name does not
correspond to parameter in query stringQuery setParameter(int position, Object value)
position
- value
- IllegalArgumentException
- if position does not
correspond to positional parameter of query
or argument is of incorrect typeQuery setParameter(int position, Date value, TemporalType temporalType)
position
- value
- temporalType
- IllegalArgumentException
- if position does not
correspond to positional parameter of queryQuery setParameter(int position, Calendar value, TemporalType temporalType)
position
- value
- temporalType
- IllegalArgumentException
- if position does not
correspond to positional parameter of queryQuery setFlushMode(FlushModeType flushMode)
flushMode
- Copyright © 2015. All rights reserved.