Skip navigation links

Oracle TopLink Java API Reference
10g Release 3 (10.1.3.1)

B28219-01


oracle.toplink.sessions.entitymanager
Interface Query

All Known Subinterfaces:
EJBQuery

public interface Query

Interface used to control query execution.


Method Summary
 int executeUpdate()
          Execute an update or delete statement.
 java.util.List getResultList()
          Execute the query and return the query results as a List.
 java.lang.Object getSingleResult()
          Execute a 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(java.lang.String hintName, java.lang.Object value)
          Set an implementation-specific hint.
 Query setMaxResults(int maxResult)
          Set the maximum number of results to retrieve.
 Query setParameter(int position, java.util.Calendar value, TemporalType temporalType)
          Bind an instance of java.util.Calendar to a positional parameter.
 Query setParameter(int position, java.util.Date value, TemporalType temporalType)
          Bind an instance of java.util.Date to a positional parameter.
 Query setParameter(int position, java.lang.Object value)
          Bind an argument to a positional parameter.
 Query setParameter(java.lang.String name, java.util.Calendar value, TemporalType temporalType)
          Bind an instance of java.util.Calendar to a named parameter.
 Query setParameter(java.lang.String name, java.util.Date value, TemporalType temporalType)
          Bind an instance of java.util.Date to a named parameter.
 Query setParameter(java.lang.String name, java.lang.Object value)
          Bind an argument to a named parameter.

 

Method Detail

getResultList

public java.util.List getResultList()
Execute the query and return the query results as a List.
Returns:
List containing the query results

getSingleResult

public java.lang.Object getSingleResult()
Execute a query that returns a single result.
Returns:
The result object

executeUpdate

public int executeUpdate()
Execute an update or delete statement.
Returns:
Update or delete row count

setMaxResults

public Query setMaxResults(int maxResult)
Set the maximum number of results to retrieve.
Parameters:
maxResult - The maximum number of results to return
Returns:
The same query instance

setFirstResult

public Query setFirstResult(int startPosition)
Set the position of the first result to retrieve.
Parameters:
startPosition - The position of the first result, numbered from 0
Returns:
The same query instance

setHint

public Query setHint(java.lang.String hintName,
                     java.lang.Object value)
Set an implementation-specific hint.
Parameters:
hintName - A vendor-specific key to indicate the hint
value - A vendor-specific value appropriate for the specified hint key
Returns:
The same query instance

setParameter

public Query setParameter(java.lang.String name,
                          java.lang.Object value)
Bind an argument to a named parameter.
Parameters:
name - The parameter name
value - The value to bind to the parameter name
Returns:
The same query instance

setParameter

public Query setParameter(java.lang.String name,
                          java.util.Date value,
                          TemporalType temporalType)
Bind an instance of java.util.Date to a named parameter.
Parameters:
name - The parameter name
value - The Date value to bind to the parameter name
temporalType - The specific part of the date to use
Returns:
The same query instance

setParameter

public Query setParameter(java.lang.String name,
                          java.util.Calendar value,
                          TemporalType temporalType)
Bind an instance of java.util.Calendar to a named parameter.
Parameters:
name - The parameter name
value - The Calendar value to bind to the parameter name
temporalType - The specific part of the Calendar to use
Returns:
The same query instance

setParameter

public Query setParameter(int position,
                          java.lang.Object value)
Bind an argument to a positional parameter.
Parameters:
position - The parameter position (numbered from 0)
value - The value to bind to the parameter position
Returns:
The same query instance

setParameter

public Query setParameter(int position,
                          java.util.Date value,
                          TemporalType temporalType)
Bind an instance of java.util.Date to a positional parameter.
Parameters:
position - The parameter position (numbered from 0)
value - The Date value to bind to the parameter position
temporalType - The specific part of the date to use
Returns:
The same query instance

setParameter

public Query setParameter(int position,
                          java.util.Calendar value,
                          TemporalType temporalType)
Bind an instance of java.util.Calendar to a positional parameter.
Parameters:
position - The parameter position (numbered from 0)
value - The Calendar value to bind to the parameter position
temporalType - The specific part of the calendar to use
Returns:
The same query instance

setFlushMode

public Query setFlushMode(FlushModeType flushMode)
Set the flush mode type to be used for the query execution.
Parameters:
flushMode -

Skip navigation links

Copyright © 1998, 2006, Oracle. All Rights Reserved.