Interface IIvyQuery
public interface IIvyQuery
Interface used to control query execution for the persistence API.
- Since:
- 08.05.2009
- API:
- This is a public API.
-
Method Summary
Modifier and TypeMethodDescriptionint
Execute an update or delete statement.List<?>
Deprecated.<T> List<T>
Execute a SELECT query and return the query results as a List.<T> T
Execute a SELECT query that returns a single result.setFirstResult
(int startPosition) Set the position of the first result to retrieve.setFlushMode
(javax.persistence.FlushModeType flushMode) Set the flush mode type to be used for the query execution.Set an implementation-specific hint.setMaxResults
(int maxResult) Set the maximum number of results to retrieve.setParameter
(int position, Object value) Bind an argument to a positional parameter.setParameter
(int position, Calendar value, javax.persistence.TemporalType temporalType) Bind an instance of java.util.Calendar to a positional parameter.setParameter
(int position, Date value, javax.persistence.TemporalType temporalType) Bind an instance of java.util.Date to a positional parameter.setParameter
(String name, Object value) Bind an argument to a named parameter.setParameter
(String name, Calendar value, javax.persistence.TemporalType temporalType) Bind an instance of java.util.Calendar to a named parameter.setParameter
(String name, Date value, javax.persistence.TemporalType temporalType) Bind an instance of java.util.Date to a named parameter.
-
Method Details
-
getResults
Execute a SELECT query and return the query results as a List. Per default (no user transaction open) the operation closes the transaction, means neithergetResultList()
norgetSingleResult()
.- Returns:
- a list of the results
- Throws:
IllegalStateException
- if called for a Java Persistence query language UPDATE or DELETE statement or if underlying entity manager is already closed then you can not execute this query again- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getResultList
Deprecated.usegetResults()
Execute a SELECT query and return the query results as a List. Per default (no user transaction open) the operation closes the transaction, means neithergetResultList()
norgetSingleResult()
.- Returns:
- a list of the results
- Throws:
IllegalStateException
- if called for a Java Persistence query language UPDATE or DELETE statement or if underlying entity manager is already closed then you can not execute this query again- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getSingleResult
<T> T getSingleResult()Execute a SELECT query that returns a single result. Per default (no user transaction open) the operation closes the transaction, means neithergetResultList()
norgetSingleResult()
.- Returns:
- the result
- Throws:
javax.persistence.NoResultException
- if there is no resultjavax.persistence.NonUniqueResultException
- if more than one resultIllegalStateException
- if called for a Java Persistence query language UPDATE or DELETE statement or if underlying entity manager is already closed then you can not execute this query again- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
executeUpdate
int executeUpdate()Execute an update or delete statement. Per default (no user transaction open) the operation closes the transaction, meansexecuteUpdate()
can not be called again.- Returns:
- the number of entities updated or deleted
- Throws:
IllegalStateException
- if called for a Java Persistence query language SELECT statement or if underlying entity manager is already closed then you can not execute this query againjavax.persistence.TransactionRequiredException
- if there is no transaction- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setMaxResults
Set the maximum number of results to retrieve.- Parameters:
maxResult
-- Returns:
- the same query instance
- Throws:
IllegalArgumentException
- if argument is negative- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setFirstResult
Set the position of the first result to retrieve.- Parameters:
startPosition
- the start position of the first result, numbered from 0- Returns:
- the same query instance
- Throws:
IllegalArgumentException
- if argument is negative- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setHint
Set an implementation-specific hint. If the hint name is not recognized, it is silently ignored.- Parameters:
hintName
-value
-- Returns:
- the same query instance
- Throws:
IllegalArgumentException
- if the second argument is not valid for the implementation- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
setParameter
Bind an argument to a named parameter.- Parameters:
name
- the parameter namevalue
-- Returns:
- the same query instance
- Throws:
IllegalArgumentException
- if parameter name does not correspond to parameter in query string or argument is of incorrect type- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setParameter
Bind an instance of java.util.Date to a named parameter.- Parameters:
name
-value
-temporalType
-- Returns:
- the same query instance
- Throws:
IllegalArgumentException
- if parameter name does not correspond to a parameter of the query- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setParameter
Bind an instance of java.util.Calendar to a named parameter.- Parameters:
name
-value
-temporalType
-- Returns:
- the same query instance
- Throws:
IllegalArgumentException
- if parameter name does not correspond to a parameter of the query- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setParameter
Bind an argument to a positional parameter.- 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- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setParameter
Bind an instance of java.util.Date to a positional parameter.- Parameters:
position
-value
-temporalType
-- Returns:
- the same query instance
- Throws:
IllegalArgumentException
- if position does not correspond to a positional parameter of the query- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setParameter
Bind an instance of java.util.Calendar to a positional parameter.- Parameters:
position
-value
-temporalType
-- Returns:
- the same query instance
- Throws:
IllegalArgumentException
- if position does not correspond to a positional parameter of the query- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
setFlushMode
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.- Parameters:
flushMode
-- Returns:
- the same query instance
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
getResults()