FileDocCategorySizeDatePackage
EJBQueryImpl.javaAPI DocGlassfish v2 API9670Tue May 22 16:54:24 BST 2007oracle.toplink.essentials.internal.ejb.cmp3

EJBQueryImpl

public class EJBQueryImpl extends EJBQueryImpl implements EJBQuery
Concrete EJB 3.0 query class To do: Internationalize exceptions Change TopLink exceptions to exception types used by the spec Named Parameters Report Query firstResultIndex set in query framework temporal type parameters Change single result to use ReadObjectQuery

Fields Summary
Constructors Summary
protected EJBQueryImpl(EntityManagerImpl entityManager)
Base constructor for EJBQueryImpl. Initializes basic variables. An EJBQLQueryImpl may only ever be tied to one entityManager.

        super(entityManager);
    
public EJBQueryImpl(DatabaseQuery query, EntityManagerImpl entityManager)
Create an EJBQueryImpl with a TopLink query.

param
query
param
entityManager

        super(query, entityManager);
    
public EJBQueryImpl(String ejbql, EntityManagerImpl entityManager)
Build an EJBQueryImpl based on the given ejbql string

param
ejbql
param
entityManager

        super(ejbql, entityManager);
    
public EJBQueryImpl(String queryDescription, EntityManagerImpl entityManager, boolean isNamedQuery)
Create an EJBQueryImpl with either a query name or an ejbql string

param
queryDescription
param
entityManager
param
isNamedQuery determines whether to treat the query description as ejbql or a query name

        super(queryDescription, entityManager, isNamedQuery);
    
Methods Summary
protected java.lang.ObjectconvertTemporalType(java.lang.Object value, javax.persistence.TemporalType type)
Convert the given object to the class represented by the given temporal type.

return
an object represting the given TemporalType

        ConversionManager conversionManager = ((oracle.toplink.essentials.internal.sessions.AbstractSession)getEntityManager().getActiveSession()).getDatasourcePlatform().getConversionManager();
        if (type == TemporalType.TIME) {
            return conversionManager.convertObject(value, ClassConstants.TIME);
        } else if (type == TemporalType.TIMESTAMP) {
            return conversionManager.convertObject(value, ClassConstants.TIMESTAMP);
        } else if (type == TemporalType.DATE) {
            return conversionManager.convertObject(value, ClassConstants.SQLDATE);
        }
        return value;
    
public oracle.toplink.essentials.ejb.cmp3.EntityManagergetEntityManager()
Return the entityManager this query is tied to.

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

param
start position of the first result, numbered from 0
return
the same query instance

        try {
            entityManager.verifyOpen();
            setFirstResultInternal(startPosition);
            return this;
        } catch (RuntimeException e) {
            setRollbackOnly();
            throw e;
        }
    
public javax.persistence.QuerysetFlushMode(javax.persistence.FlushModeType flushMode)
Set the flush mode type to be used for the query execution.

param
flushMode

        try {
            entityManager.verifyOpen();
            if (flushMode == null) {
                getDatabaseQuery().setFlushOnExecute(null);
            } else {
                getDatabaseQuery().setFlushOnExecute(flushMode == FlushModeType.AUTO);
            }
            return this;
        } catch (RuntimeException e) {
            setRollbackOnly();
            throw e;
        }
    
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

        try {
            entityManager.verifyOpen();
            setHintInternal(hintName, value);
            return this;
        } catch (RuntimeException e) {
            setRollbackOnly();
            throw e;
        }
    
public javax.persistence.QuerysetMaxResults(int maxResult)
Set the maximum number of results to retrieve.

param
maxResult
return
the same query instance

        try {
            entityManager.verifyOpen();
            setMaxResultsInternal(maxResult);
            return this;
        } catch (RuntimeException e) {
            setRollbackOnly();
            throw e;
        }
    
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

        try {
            entityManager.verifyOpen();
            setParameterInternal(name, value);
            return this;
        } catch (RuntimeException e) {
            setRollbackOnly();
            throw e;
        }
    
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

        return setParameter(name, convertTemporalType(value, temporalType));
    
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

        return setParameter(name, convertTemporalType(value, temporalType));
    
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

        try {
            entityManager.verifyOpen();
            setParameterInternal(position, value);
            return this;
        } catch (RuntimeException e) {
            setRollbackOnly();
            throw e;
        }
    
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 Query API Enterprise JavaBeans 3.0, Early Draft Entity Beans Sun Microsystems Inc
param
temporalType
return
the same query instance

        return setParameter(position, convertTemporalType(value, temporalType));
    
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

        return setParameter(position, convertTemporalType(value, temporalType));
    
protected voidthrowNoResultException(java.lang.String message)

        throw new NoResultException(message);
    
protected voidthrowNonUniqueResultException(java.lang.String message)

        throw new NonUniqueResultException(message);