FileDocCategorySizeDatePackage
Query.javaAPI DocGlassfish v2 API6715Fri May 04 22:34:08 BST 2007javax.persistence

Query

public interface Query
Interface used to control query execution.
since
Java Persistence 1.0

Fields Summary
Constructors Summary
Methods Summary
public intexecuteUpdate()
Execute an update or delete statement.

return
the number of entities updated or deleted
throws
IllegalStateException if called for a Java Persistence query language SELECT statement
throws
TransactionRequiredException if there is no transaction

public java.util.ListgetResultList()
Execute a SELECT query and return the query results as a List.

return
a list of the results
throws
IllegalStateException if called for a Java Persistence query language UPDATE or DELETE statement

public java.lang.ObjectgetSingleResult()
Execute a SELECT query that returns a single result.

return
the result
throws
NoResultException if there is no result
throws
NonUniqueResultException if more than one result
throws
IllegalStateException if called for a Java Persistence query language UPDATE or DELETE statement

public javax.persistence.QuerysetFirstResult(int startPosition)
Set the position of the first result to retrieve.

param
startPosition the start position of the first result, numbered from 0
return
the same query instance
throws
IllegalArgumentException if argument is negative

public javax.persistence.QuerysetFlushMode(javax.persistence.FlushModeType flushMode)
Set the flush mode type to be used for the query execution. The flush mode type applies to the query regardless of the flush mode type in use for the entity manager.

param
flushMode

public javax.persistence.QuerysetHint(java.lang.String hintName, java.lang.Object value)
Set an implementation-specific hint. If the hint name is not recognized, it is silently ignored.

param
hintName
param
value
return
the same query instance
throws
IllegalArgumentException if the second argument is not valid for the implementation

public javax.persistence.QuerysetMaxResults(int maxResult)
Set the maximum number of results to retrieve.

param
maxResult
return
the same query instance
throws
IllegalArgumentException if argument is negative

public javax.persistence.QuerysetParameter(int position, java.lang.Object value)
Bind an argument to a positional parameter.

param
position
param
value
return
the same query instance
throws
IllegalArgumentException if position does not correspond to positional parameter of query or argument is of incorrect type

public javax.persistence.QuerysetParameter(int position, java.util.Date value, javax.persistence.TemporalType temporalType)
Bind an instance of java.util.Date to a positional parameter.

param
position
param
value
param
temporalType
return
the same query instance
throws
IllegalArgumentException if position does not correspond to positional parameter of query

public javax.persistence.QuerysetParameter(int position, java.util.Calendar value, javax.persistence.TemporalType temporalType)
Bind an instance of java.util.Calendar to a positional parameter.

param
position
param
value
param
temporalType
return
the same query instance
throws
IllegalArgumentException if position does not correspond to positional parameter of query

public javax.persistence.QuerysetParameter(java.lang.String name, java.lang.Object value)
Bind an argument to a named parameter.

param
name the parameter name
param
value
return
the same query instance
throws
IllegalArgumentException if parameter name does not correspond to parameter in query string or argument is of incorrect type

public javax.persistence.QuerysetParameter(java.lang.String name, java.util.Date value, javax.persistence.TemporalType temporalType)
Bind an instance of java.util.Date to a named parameter.

param
name
param
value
param
temporalType
return
the same query instance
throws
IllegalArgumentException if parameter name does not correspond to parameter in query string

public javax.persistence.QuerysetParameter(java.lang.String name, java.util.Calendar value, javax.persistence.TemporalType temporalType)
Bind an instance of java.util.Calendar to a named parameter.

param
name
param
value
param
temporalType
return
the same query instance
throws
IllegalArgumentException if parameter name does not correspond to parameter in query string