Search in sources :

Example 1 with FinderException

use of javax.ejb.FinderException in project tomee by apache.

the class JpaCmpEngine method queryBeans.

public List<Object> queryBeans(final BeanContext beanContext, final String signature, final Object[] args) throws FinderException {
    final EntityManager entityManager = getEntityManager(beanContext);
    Query query = createNamedQuery(entityManager, signature);
    if (query == null) {
        final int parenIndex = signature.indexOf('(');
        if (parenIndex > 0) {
            final String shortName = signature.substring(0, parenIndex);
            query = createNamedQuery(entityManager, shortName);
        }
        if (query == null) {
            throw new FinderException("No query defined for method " + signature);
        }
    }
    return executeSelectQuery(query, args);
}
Also used : FinderException(javax.ejb.FinderException) EntityManager(javax.persistence.EntityManager) Query(javax.persistence.Query)

Example 2 with FinderException

use of javax.ejb.FinderException in project tomee by apache.

the class EjbSelect method execute_void.

/**
     * Perform a select operation when the return value is
     * a void.  This one is slightly different from the
     * rest, as the container operation performed is an
     * update() rather than a select() because there's
     * no value to return.
     *
     * @param obj             The ejb object we're executing on behalf of.
     * @param methodSignature The signature of the selectxxxx method being invoked.
     * @param args            The arguments to the select.  These need to match
     *                        the method signature.
     * @throws FinderException
     */
public static void execute_void(final Object obj, final String methodSignature, final Object... args) throws FinderException {
    final BeanContext beanContext = (BeanContext) obj;
    final Container container = beanContext.getContainer();
    if (!(container instanceof CmpContainer)) {
        throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
    }
    final CmpContainer cmpContainer = (CmpContainer) container;
    cmpContainer.update(beanContext, methodSignature, args);
}
Also used : BeanContext(org.apache.openejb.BeanContext) FinderException(javax.ejb.FinderException) CmpContainer(org.apache.openejb.core.cmp.CmpContainer) Container(org.apache.openejb.Container) CmpContainer(org.apache.openejb.core.cmp.CmpContainer)

Example 3 with FinderException

use of javax.ejb.FinderException in project tomee by apache.

the class EjbSelect method execute_short.

public static short execute_short(final Object obj, final String methodSignature, final Object... args) throws FinderException {
    final BeanContext beanContext = (BeanContext) obj;
    final Container container = beanContext.getContainer();
    if (!(container instanceof CmpContainer)) {
        throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
    }
    final CmpContainer cmpContainer = (CmpContainer) container;
    final Number result = (Number) cmpContainer.select(beanContext, methodSignature, "short", args);
    return result.shortValue();
}
Also used : BeanContext(org.apache.openejb.BeanContext) FinderException(javax.ejb.FinderException) CmpContainer(org.apache.openejb.core.cmp.CmpContainer) Container(org.apache.openejb.Container) CmpContainer(org.apache.openejb.core.cmp.CmpContainer)

Example 4 with FinderException

use of javax.ejb.FinderException in project tomee by apache.

the class EjbSelect method execute_char.

public static char execute_char(final Object obj, final String methodSignature, final Object... args) throws FinderException {
    final BeanContext beanContext = (BeanContext) obj;
    final Container container = beanContext.getContainer();
    if (!(container instanceof CmpContainer)) {
        throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
    }
    final CmpContainer cmpContainer = (CmpContainer) container;
    final Character result = (Character) cmpContainer.select(beanContext, methodSignature, "char", args);
    return result.charValue();
}
Also used : BeanContext(org.apache.openejb.BeanContext) FinderException(javax.ejb.FinderException) CmpContainer(org.apache.openejb.core.cmp.CmpContainer) Container(org.apache.openejb.Container) CmpContainer(org.apache.openejb.core.cmp.CmpContainer)

Example 5 with FinderException

use of javax.ejb.FinderException in project tomee by apache.

the class EjbSelect method execute_long.

public static long execute_long(final Object obj, final String methodSignature, final Object... args) throws FinderException {
    final BeanContext beanContext = (BeanContext) obj;
    final Container container = beanContext.getContainer();
    if (!(container instanceof CmpContainer)) {
        throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
    }
    final CmpContainer cmpContainer = (CmpContainer) container;
    final Number result = (Number) cmpContainer.select(beanContext, methodSignature, "long", args);
    return result.longValue();
}
Also used : BeanContext(org.apache.openejb.BeanContext) FinderException(javax.ejb.FinderException) CmpContainer(org.apache.openejb.core.cmp.CmpContainer) Container(org.apache.openejb.Container) CmpContainer(org.apache.openejb.core.cmp.CmpContainer)

Aggregations

FinderException (javax.ejb.FinderException)21 BeanContext (org.apache.openejb.BeanContext)14 Container (org.apache.openejb.Container)10 CmpContainer (org.apache.openejb.core.cmp.CmpContainer)10 Connection (java.sql.Connection)5 PreparedStatement (java.sql.PreparedStatement)5 InitialContext (javax.naming.InitialContext)5 EJBException (javax.ejb.EJBException)4 EJBLocalObject (javax.ejb.EJBLocalObject)4 EJBObject (javax.ejb.EJBObject)4 RemoteException (java.rmi.RemoteException)3 ResultSet (java.sql.ResultSet)3 EntityBean (javax.ejb.EntityBean)3 ObjectNotFoundException (javax.ejb.ObjectNotFoundException)3 RemoveException (javax.ejb.RemoveException)3 EntityManager (javax.persistence.EntityManager)3 Query (javax.persistence.Query)3 DataSource (javax.sql.DataSource)3 NoSuchObjectException (java.rmi.NoSuchObjectException)2 SQLException (java.sql.SQLException)2