You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by da...@apache.org on 2007/03/29 06:28:40 UTC
svn commit: r523552 [1/2] - in /incubator/openejb/trunk/openejb3:
container/openejb-core/src/main/java/org/apache/openejb/alt/containers/castor_cmp11/
container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/
container/openejb-core/src...
Author: dain
Date: Wed Mar 28 21:28:38 2007
New Revision: 523552
URL: http://svn.apache.org/viewvc?view=rev&rev=523552
Log:
Finished ejbSelect support
Added:
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/EjbSelect.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryBean.java
- copied, changed from r522662, incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ABean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataBean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataHome.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataLocal.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataLocalHome.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataRemote.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryHome.java
- copied, changed from r522662, incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/AHome.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryLocal.java
- copied, changed from r522662, incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ALocal.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryLocalHome.java
- copied, changed from r522662, incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ALocalHome.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryRemote.java
- copied, changed from r522662, incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ARemote.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/EjbqlLocalTest.java
Removed:
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ABean.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/AHome.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ALocal.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ALocalHome.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ARemote.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp2/EJBQLTest.java
Modified:
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/containers/castor_cmp11/CastorCmpEngine.java
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EnterpriseBeanBuilder.java
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/QueryInfo.java
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckMethods.java
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/CoreDeploymentInfo.java
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpEngine.java
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Generator.java
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/jpa/JpaCmpEngine.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/ejb-jar.xml
incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/openejb-jar.xml
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/HsqldbTestDatabase.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp/CmpLocalTestSuite.java
incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmp/CmpTestSuite.java
incubator/openejb/trunk/openejb3/server/openejb-ejbd/src/test/java/org/apache/openejb/RemoteiTest.java
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/containers/castor_cmp11/CastorCmpEngine.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/containers/castor_cmp11/CastorCmpEngine.java?view=diff&rev=523552&r1=523551&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/containers/castor_cmp11/CastorCmpEngine.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/containers/castor_cmp11/CastorCmpEngine.java Wed Mar 28 21:28:38 2007
@@ -284,6 +284,10 @@
}
}
+ public List<Object> queryBeans(CoreDeploymentInfo deploymentInfo, String signature, Object[] args) throws FinderException {
+ throw new FinderException("ejbSelect methods not implemented for castor cmp engine");
+ }
+
private String preprocessQuery(String queryString) {
// OQL uses FQN for abstract schema name so replace abstract
// schema name with FQN
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EnterpriseBeanBuilder.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EnterpriseBeanBuilder.java?view=diff&rev=523552&r1=523551&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EnterpriseBeanBuilder.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EnterpriseBeanBuilder.java Wed Mar 28 21:28:38 2007
@@ -276,6 +276,23 @@
for (Method method : finderMethods) {
deployment.addQuery(method, query.queryStatement);
}
+
+ if (query.remoteResultType) {
+ StringBuilder methodSignature = new StringBuilder();
+ methodSignature.append(query.method.methodName);
+ if (query.method.methodParams != null && !query.method.methodParams.isEmpty()) {
+ methodSignature.append('(');
+ boolean first = true;
+ for (String methodParam : query.method.methodParams) {
+ if (!first) methodSignature.append(",");
+ methodSignature.append(methodParam);
+ first = false;
+ }
+ methodSignature.append(')');
+ }
+ deployment.setRemoteQueryResults(methodSignature.toString());
+ }
+
}
deployment.setCmrFields(entity.cmpFieldNames.toArray(new String[]{}));
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/QueryInfo.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/QueryInfo.java?view=diff&rev=523552&r1=523551&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/QueryInfo.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/QueryInfo.java Wed Mar 28 21:28:38 2007
@@ -21,5 +21,5 @@
public String description;
public MethodInfo method;
public String queryStatement;
-
+ public boolean remoteResultType;
}
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java?view=diff&rev=523552&r1=523551&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/EjbJarInfoBuilder.java Wed Mar 28 21:28:38 2007
@@ -69,6 +69,7 @@
import org.apache.openejb.jee.SessionType;
import org.apache.openejb.jee.TransactionType;
import org.apache.openejb.jee.ExcludeList;
+import org.apache.openejb.jee.ResultTypeMapping;
import org.apache.openejb.jee.oejb3.EjbDeployment;
import org.apache.openejb.loader.SystemInstance;
import org.apache.openejb.util.Logger;
@@ -567,8 +568,14 @@
MethodInfo method = new MethodInfo();
QueryMethod qm = q.getQueryMethod();
method.methodName = qm.getMethodName();
- method.methodParams = qm.getMethodParams().getMethodParam();
+ if (qm.getMethodParams() != null) {
+ method.methodParams = qm.getMethodParams().getMethodParam();
+ }
query.method = method;
+ ResultTypeMapping resultType = q.getResultTypeMapping();
+ if (ResultTypeMapping.REMOTE.equals(resultType)) {
+ query.remoteResultType = true;
+ }
bean.queries.add(query);
}
@@ -580,7 +587,9 @@
MethodInfo method = new MethodInfo();
org.apache.openejb.jee.oejb3.QueryMethod qm = q.getQueryMethod();
method.methodName = qm.getMethodName();
- method.methodParams = qm.getMethodParams().getMethodParam();
+ if (qm.getMethodParams() != null) {
+ method.methodParams = qm.getMethodParams().getMethodParam();
+ }
query.method = method;
bean.queries.add(query);
}
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckMethods.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckMethods.java?view=diff&rev=523552&r1=523551&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckMethods.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckMethods.java Wed Mar 28 21:28:38 2007
@@ -158,6 +158,11 @@
return false;
}
+ if (b instanceof EntityBean) {
+ // entity beans are not required to have a create method
+ return false;
+ }
+
Method[] homeMethods = home.getMethods();
boolean hasCreateMethod = false;
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/CoreDeploymentInfo.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/CoreDeploymentInfo.java?view=diff&rev=523552&r1=523551&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/CoreDeploymentInfo.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/CoreDeploymentInfo.java Wed Mar 28 21:28:38 2007
@@ -25,6 +25,7 @@
import java.util.Collections;
import java.util.Set;
import java.util.ArrayList;
+import java.util.TreeSet;
import javax.ejb.EJBHome;
import javax.ejb.EJBLocalHome;
import javax.ejb.EJBLocalObject;
@@ -34,7 +35,6 @@
import javax.ejb.Timer;
import javax.persistence.EntityManagerFactory;
import javax.naming.Context;
-import javax.security.auth.Subject;
import org.apache.openejb.Container;
import org.apache.openejb.RpcContainer;
@@ -922,6 +922,7 @@
private String abstractSchemaName;
private Map<Method, String> queryMethodMap = new HashMap<Method, String>();
+ private Set<String> remoteQueryResults = new TreeSet<String>();
public boolean isCmp2() {
return cmp2;
@@ -961,6 +962,14 @@
public String getQuery(Method queryMethod) {
return queryMethodMap.get(queryMethod);
+ }
+
+ public void setRemoteQueryResults(String methodSignature) {
+ remoteQueryResults.add(methodSignature);
+ }
+
+ public boolean isRemoteQueryResults(String methodSignature) {
+ return remoteQueryResults.contains(methodSignature);
}
public Class getCmpImplClass() {
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java?view=diff&rev=523552&r1=523551&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java Wed Mar 28 21:28:38 2007
@@ -28,6 +28,9 @@
import java.util.List;
import java.util.Map;
import java.util.Vector;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.ArrayList;
import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.EJBHome;
@@ -38,6 +41,7 @@
import javax.ejb.ObjectNotFoundException;
import javax.ejb.RemoveException;
import javax.ejb.Timer;
+import javax.ejb.FinderException;
import javax.transaction.TransactionManager;
import org.apache.openejb.ApplicationException;
@@ -51,6 +55,7 @@
import org.apache.openejb.core.ThreadContext;
import org.apache.openejb.core.timer.EjbTimerService;
import org.apache.openejb.core.entity.EntityContext;
+import org.apache.openejb.core.entity.EntityEjbHomeHandler;
import org.apache.openejb.core.transaction.TransactionContainer;
import org.apache.openejb.core.transaction.TransactionContext;
import org.apache.openejb.core.transaction.TransactionPolicy;
@@ -59,6 +64,7 @@
import org.apache.openejb.core.transaction.TxRequiresNew;
import org.apache.openejb.spi.SecurityService;
import org.apache.openejb.util.Enumerator;
+import org.apache.openejb.util.proxy.ProxyManager;
/**
* @org.apache.xbean.XBean element="cmpContainer"
@@ -697,6 +703,103 @@
txPolicy.afterInvoke(null, txContext);
}
throw new AssertionError("Should not get here");
+ }
+
+ public Object select(DeploymentInfo di, String methodSignature, String returnType, Object... args) throws FinderException {
+ CoreDeploymentInfo deploymentInfo = (CoreDeploymentInfo) di;
+ String signature = deploymentInfo.getAbstractSchemaName() + "." + methodSignature;
+
+ try {
+ CmpEngine cmpEngine = getCmpEngine(deploymentInfo);
+ List<Object> results = cmpEngine.queryBeans(deploymentInfo, signature, args);
+
+ Iterator<Object> iterator = results.iterator();
+ if (iterator.hasNext()) {
+ Class<? extends Object> type = iterator.next().getClass();
+ CoreDeploymentInfo resultInfo = (CoreDeploymentInfo) deploymentsByClass.get(type);
+ if (resultInfo != null) {
+ //
+ // Note we assume all results are the same java type, which won't be true for union queries
+ //
+ KeyGenerator kg = resultInfo.getKeyGenerator();
+
+ // get the proxy interface and home proxy handler
+ Class proxyInterface;
+ EntityEjbHomeHandler handler;
+ if (deploymentInfo.isRemoteQueryResults(methodSignature)) {
+ EJBHome homeProxy = resultInfo.getEJBHome();
+ handler = (EntityEjbHomeHandler) ProxyManager.getInvocationHandler(homeProxy);
+ proxyInterface = resultInfo.getRemoteInterface();
+ } else {
+ EJBLocalHome homeProxy = resultInfo.getEJBLocalHome();
+ handler = (EntityEjbHomeHandler) ProxyManager.getInvocationHandler(homeProxy);
+ proxyInterface = resultInfo.getLocalInterface();
+ }
+
+ List<Object> proxies = new ArrayList<Object>();
+ for (Object value : results) {
+ EntityBean bean = (EntityBean) value;
+
+ // The KeyGenerator creates a new primary key and populates its fields with the
+ // primary key fields of the bean instance. Each deployment has its own KeyGenerator.
+ Object primaryKey = kg.getPrimaryKey(bean);
+
+ // create a new ProxyInfo based on the deployment info and primary key and add it to the vector
+ ProxyInfo proxyInfo = new ProxyInfo(resultInfo, primaryKey, proxyInterface, this);
+
+ // create the proxy
+ Object proxy = handler.createProxy(proxyInfo);
+ proxies.add(proxy);
+ }
+ results = proxies;
+ }
+ }
+// KeyGenerator kg = deploymentInfo.getKeyGenerator();
+//
+// Class<?> callingClass = callMethod.getDeclaringClass();
+// Class objectInterface = deploymentInfo.getObjectInterface(callingClass);
+//
+// /*
+// The following block of code is responsible for returning ProxyInfo object(s) for each
+// matching entity bean found by the query. If its a multi-value find operation a Vector
+// of ProxyInfo objects will be returned. If its a single-value find operation then a
+// single ProxyInfo object is returned.
+// */
+// if (callMethod.getReturnType() == Collection.class || callMethod.getReturnType() == Enumeration.class) {
+// Vector<ProxyInfo> proxies = new Vector<ProxyInfo>();
+// for (Object value : results) {
+// EntityBean bean = (EntityBean) value;
+//
+// /*
+// The KeyGenerator creates a new primary key and populates its fields with the
+// primary key fields of the bean instance. Each deployment has its own KeyGenerator.
+// */
+// Object primaryKey = kg.getPrimaryKey(bean);
+// /* create a new ProxyInfo based on the deployment info and primary key and add it to the vector */
+// proxies.addElement(new ProxyInfo(deploymentInfo, primaryKey, objectInterface, this));
+// }
+// if (callMethod.getReturnType() == Enumeration.class) {
+// return new Enumerator(proxies);
+// } else {
+// return proxies;
+// }
+// } else {
+// if (results.size() != 1) throw new ObjectNotFoundException("A Enteprise bean with deployment_id = " + deploymentInfo.getDeploymentID() + " and primarykey = " + args[0] + " Does not exist");
+//
+// // create a new ProxyInfo based on the deployment info and primary key
+// EntityBean bean = (EntityBean) results.get(0);
+// Object primaryKey = kg.getPrimaryKey(bean);
+// return new ProxyInfo(deploymentInfo, primaryKey, objectInterface, this);
+// }
+ if (returnType.equals("java.util.Collection") || returnType.equals("java.util.Set")) {
+ return results;
+ }
+ return results.iterator().next();
+ } catch (FinderException e) {
+ throw e;
+ } catch (RuntimeException e) {// handle reflection exception
+ throw new EJBException(e);
+ }
}
private void removeEJBObject(Method callMethod, ThreadContext callContext) throws OpenEJBException {
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpEngine.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpEngine.java?view=diff&rev=523552&r1=523551&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpEngine.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpEngine.java Wed Mar 28 21:28:38 2007
@@ -39,6 +39,8 @@
List<Object> queryBeans(ThreadContext callContext, Method queryMethod, Object[] args) throws FinderException;
+ List<Object> queryBeans(CoreDeploymentInfo deploymentInfo, String signature, Object[] args) throws FinderException;
+
void deploy(CoreDeploymentInfo deploymentInfo) throws OpenEJBException;
void undeploy(CoreDeploymentInfo deploymentInfo) throws OpenEJBException;
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Generator.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Generator.java?view=diff&rev=523552&r1=523551&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Generator.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Generator.java Wed Mar 28 21:28:38 2007
@@ -26,12 +26,24 @@
import java.lang.reflect.Method;
import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
import java.util.LinkedHashMap;
import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.HashMap;
public class Cmp2Generator implements Opcodes {
private static final String UNKNOWN_PK_NAME = "OpenEJB_pk";
private static final Type UNKNOWN_PK_TYPE = Type.getType(Long.class);
+ private static final Method EJB_SELECT_EXECUTE;
+ static {
+ try {
+ EJB_SELECT_EXECUTE = EjbSelect.class.getMethod("execute", Object.class, String.class, String.class, Object[].class);
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+ }
private final String implClassName;
private final String beanClassName;
@@ -40,6 +52,7 @@
private final Map<String, CmrField> cmrFields = new LinkedHashMap<String, CmrField>();
private final CmpField pkField;
private final Class primKeyClass;
+ private final List<Method> selectMethods = new ArrayList<Method>();
public Cmp2Generator(String cmpImplClass, Class beanClass, String pkField, Class<?> primKeyClass, String[] cmrFields) {
if (pkField == null && primKeyClass == null) throw new NullPointerException("Both pkField and primKeyClass are null");
@@ -68,6 +81,12 @@
this.pkField = null;
}
+ for (Method method : beanClass.getMethods()) {
+ if (Modifier.isAbstract(method.getModifiers()) && method.getName().startsWith("ejbSelect")) {
+ addSelectMethod(method);
+ }
+ }
+
cw = new ClassWriter(true);
}
@@ -75,6 +94,10 @@
cmrFields.put(cmrField.getName(), cmrField);
}
+ public void addSelectMethod(Method selectMethod) {
+ selectMethods.add(selectMethod);
+ }
+
public byte[] generate() {
cw.visit(V1_5, ACC_PUBLIC + ACC_SUPER, implClassName, null, beanClassName, new String[]{"org/apache/openejb/core/cmp/cmp2/Cmp2Entity"});
@@ -131,6 +154,10 @@
createOpenEJB_removeCmr();
+ for (Method selectMethod : selectMethods) {
+ createSelectMethod(selectMethod);
+ }
+
cw.visitEnd();
return cw.toByteArray();
@@ -295,6 +322,7 @@
private void createGetter(CmpField cmpField) {
String methodName = getterName(cmpField.getName());
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, methodName, "()" + cmpField.getDescriptor(), null, null);
+ mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, implClassName, cmpField.getName(), cmpField.getDescriptor());
mv.visitInsn(cmpField.getType().getOpcode(IRETURN));
@@ -309,6 +337,7 @@
private void createSetter(CmpField cmpField) {
String methodName = setterName(cmpField.getName());
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, methodName, "(" + cmpField.getDescriptor() + ")V", null, null);
+ mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(cmpField.getType().getOpcode(ILOAD), 1);
mv.visitFieldInsn(PUTFIELD, implClassName, cmpField.getName(), cmpField.getDescriptor());
@@ -323,6 +352,7 @@
private void createSimplePrimaryKeyGetter() {
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "OpenEJB_getPrimaryKey", "()Ljava/lang/Object;", null, null);
+ mv.visitCode();
if (pkField != null) {
// push the pk field
mv.visitVarInsn(ALOAD, 0);
@@ -602,5 +632,179 @@
// end of if statement
mv.visitLabel(end);
+ }
+
+ private void createSelectMethod(Method selectMethod) {
+ MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, selectMethod.getName(), Type.getMethodDescriptor(selectMethod), null, getExceptionTypes(selectMethod));
+ mv.visitCode();
+
+ // push deploymentInfo
+ mv.visitFieldInsn(GETSTATIC, implClassName, "deploymentInfo", "Ljava/lang/Object;");
+
+ // push method signature
+ mv.visitLdcInsn(getSelectMethodSignature(selectMethod));
+
+ // push return type
+ mv.visitLdcInsn(selectMethod.getReturnType().getName());
+
+ // new Object[]
+ mv.visitIntInsn(BIPUSH, selectMethod.getParameterTypes().length);
+ mv.visitTypeInsn(ANEWARRAY, "java/lang/Object");
+
+ // object[i] = arg${i}
+ int i = 0;
+ for (Class<?> parameterType : selectMethod.getParameterTypes()) {
+ // push arguement i on stack
+ mv.visitInsn(DUP);
+ bipush(mv, i);
+ mv.visitVarInsn(Type.getType(parameterType).getOpcode(ILOAD), i + 1);
+
+ // convert argument on stack to an Object
+ Convert.toObjectFrom(mv, parameterType);
+
+ // store it into the array
+ mv.visitInsn(AASTORE);
+
+ if (long.class.equals(parameterType) || double.class.equals(parameterType)) {
+ // longs and doubles are double wide
+ i = i + 2;
+ } else {
+ i++;
+ }
+ }
+
+ // EjbSelect.execute(deploymentInfo, signature, args[]);
+ mv.visitMethodInsn(INVOKESTATIC,
+ Type.getInternalName(EJB_SELECT_EXECUTE.getDeclaringClass()),
+ EJB_SELECT_EXECUTE.getName(),
+ Type.getMethodDescriptor(EJB_SELECT_EXECUTE));
+
+ // convert return type
+ Convert.fromObjectTo(mv, selectMethod.getReturnType());
+
+ // return
+ mv.visitInsn(Type.getReturnType(selectMethod).getOpcode(IRETURN));
+
+ // close method
+ mv.visitMaxs(0, 0);
+ mv.visitEnd();
+ }
+
+ private String getSelectMethodSignature(Method selectMethod) {
+ StringBuilder signature = new StringBuilder();
+ signature.append(selectMethod.getName());
+ if (selectMethod.getParameterTypes().length > 0) {
+ signature.append('(');
+ boolean first = true;
+ for (Class<?> parameterType : selectMethod.getParameterTypes()) {
+ if (!first) signature.append(',');
+ signature.append(parameterType.getCanonicalName());
+ first = false;
+ }
+ signature.append(')');
+ }
+ return signature.toString();
+ }
+
+ private static String[] getExceptionTypes(Method method) {
+ List<String> types = new ArrayList<String>(method.getExceptionTypes().length);
+ for (Class<?> exceptionType : method.getExceptionTypes()) {
+ types.add(Type.getInternalName(exceptionType));
+ }
+ return types.toArray(new String[types.size()]);
+ }
+
+ private static void bipush(MethodVisitor mv, int i) {
+ switch(i) {
+ case -1:
+ mv.visitInsn(ICONST_M1);
+ break;
+ case 0:
+ mv.visitInsn(ICONST_0);
+ break;
+ case 1:
+ mv.visitInsn(ICONST_1);
+ break;
+ case 2:
+ mv.visitInsn(ICONST_2);
+ break;
+ case 3:
+ mv.visitInsn(ICONST_3);
+ break;
+ case 4:
+ mv.visitInsn(ICONST_4);
+ break;
+ case 5:
+ mv.visitInsn(ICONST_5);
+ break;
+ default:
+ mv.visitIntInsn(BIPUSH, i);
+ }
+
+ }
+ private static class Convert {
+ public static void toObjectFrom(MethodVisitor mv, Class from) {
+ if (from.isPrimitive()) {
+ Convert conversion = getConversion(from);
+ if (conversion == null) throw new NullPointerException("conversion is null " + from.getName() + " " + from.isPrimitive());
+ conversion.primitiveToObject(mv);
+ }
+ }
+
+ public static void fromObjectTo(MethodVisitor mv, Class to) {
+ if (to.equals(Object.class)) {
+ // direct assignment will work
+ } else if (!to.isPrimitive()) {
+ mv.visitTypeInsn(CHECKCAST, Type.getInternalName(to));
+ } else {
+ Convert conversion = getConversion(to);
+ conversion.objectToPrimitive(mv);
+ }
+ }
+
+ private static Map<Class, Convert> conversionsByPrimitive = new HashMap<Class, Convert>();
+
+ public static Convert getConversion(Class primitive) {
+ if (!primitive.isPrimitive()) {
+ throw new IllegalArgumentException(primitive.getName() + " is not a primitive class");
+ }
+ return conversionsByPrimitive.get(primitive);
+ }
+
+ public static final Convert BOOLEAN = new Convert(boolean.class, Boolean.class, "booleanValue");
+ public static final Convert CHAR = new Convert(char.class, Character.class, "charValue");
+ public static final Convert BYTE = new Convert(byte.class, Byte.class, "byteValue");
+ public static final Convert SHORT = new Convert(short.class, Short.class, "shortValue");
+ public static final Convert INT = new Convert(int.class, Integer.class, "intValue");
+ public static final Convert LONG = new Convert(long.class, Long.class, "longValue");
+ public static final Convert FLOAT = new Convert(float.class, Float.class, "floatValue");
+ public static final Convert DOUBLE = new Convert(double.class, Double.class, "doubleValue");
+
+ private Type objectType;
+ private final Method toPrimitive;
+ private final Method toObject;
+
+ private Convert(Class primitiveClass, Class objectClass, String toPrimitiveMethodName) {
+ objectType = Type.getType(objectClass);
+
+ try {
+ toObject = objectClass.getMethod("valueOf", primitiveClass);
+ toPrimitive = objectClass.getMethod(toPrimitiveMethodName);
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+
+ conversionsByPrimitive.put(primitiveClass, this);
+ }
+
+ public void primitiveToObject(MethodVisitor mv) {
+ mv.visitMethodInsn(INVOKESTATIC, objectType.getInternalName(), toObject.getName(), Type.getMethodDescriptor(toObject));
+ }
+
+ public void objectToPrimitive(MethodVisitor mv) {
+ mv.visitTypeInsn(CHECKCAST, objectType.getInternalName());
+ mv.visitMethodInsn(INVOKEVIRTUAL, objectType.getInternalName(), toPrimitive.getName(), Type.getMethodDescriptor(toPrimitive));
+ }
+
}
}
Added: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/EjbSelect.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/EjbSelect.java?view=auto&rev=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/EjbSelect.java (added)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/EjbSelect.java Wed Mar 28 21:28:38 2007
@@ -0,0 +1,41 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.core.cmp.cmp2;
+
+import org.apache.openejb.Container;
+import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.core.cmp.CmpContainer;
+
+import javax.ejb.FinderException;
+
+/**
+ * DO NOT REFACTOR THIS CLASS. This class is referenced directly by generated code.
+ */
+public class EjbSelect {
+ public static Object execute(Object di, String methodSignature, String returnType, Object... args) throws FinderException {
+ DeploymentInfo deploymentInfo = (DeploymentInfo) di;
+ Container container = deploymentInfo.getContainer();
+ if (!(container instanceof CmpContainer)) {
+ throw new FinderException("Deployment is not connected to a CmpContainer " + deploymentInfo.getDeploymentID());
+ }
+ CmpContainer cmpContainer = (CmpContainer) container;
+ Object result = cmpContainer.select(deploymentInfo, methodSignature, returnType, args);
+ return result;
+
+ }
+}
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/jpa/JpaCmpEngine.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/jpa/JpaCmpEngine.java?view=diff&rev=523552&r1=523551&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/jpa/JpaCmpEngine.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/jpa/JpaCmpEngine.java Wed Mar 28 21:28:38 2007
@@ -44,13 +44,11 @@
import org.apache.openejb.core.cmp.KeyGenerator;
import org.apache.openejb.core.cmp.SimpleKeyGenerator;
import org.apache.openejb.core.cmp.cmp2.Cmp2KeyGenerator;
-import org.apache.openejb.util.Logger;
import org.apache.openjpa.event.AbstractLifecycleListener;
import org.apache.openjpa.event.LifecycleEvent;
import org.apache.openjpa.persistence.OpenJPAEntityManager;
public class JpaCmpEngine implements CmpEngine {
- private static final Logger logger = Logger.getInstance("OpenEJB", "org.apache.openejb.core.cmp");
private static final Object[] NO_ARGS = new Object[0];
public static final String CMP_PERSISTENCE_CONTEXT_REF_NAME = "openejb/cmp";
@@ -164,7 +162,6 @@
}
public List<Object> queryBeans(ThreadContext callContext, Method queryMethod, Object[] args) throws FinderException {
- logger.error("Executing query " + queryMethod);
CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
EntityManager entityManager = getEntityManager(deploymentInfo);
@@ -190,7 +187,27 @@
throw new FinderException("No query defined for method " + fullName);
}
}
+ return executeQuery(query, args);
+ }
+
+ public List<Object> queryBeans(CoreDeploymentInfo deploymentInfo, String signature, Object[] args) throws FinderException {
+ EntityManager entityManager = getEntityManager(deploymentInfo);
+
+ Query query = createNamedQuery(entityManager, signature);
+ if (query == null) {
+ int parenIndex = signature.indexOf('(');
+ if (parenIndex > 0) {
+ String shortName = signature.substring(0, parenIndex);
+ query = createNamedQuery(entityManager, shortName);
+ }
+ if (query == null) {
+ throw new FinderException("No query defined for method " + signature);
+ }
+ }
+ return executeQuery(query, args);
+ }
+ private List<Object> executeQuery(Query query, Object[] args) {
// process args
if (args == null) {
args = NO_ARGS;
Copied: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryBean.java (from r522662, incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ABean.java)
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryBean.java?view=diff&rev=523552&p1=incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ABean.java&r1=522662&p2=incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryBean.java&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ABean.java (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryBean.java Wed Mar 28 21:28:38 2007
@@ -16,74 +16,231 @@
*/
package org.apache.openejb.test.entity.ejbql;
-
-import javax.ejb.CreateException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.FinderException;
-import javax.ejb.RemoveException;
+import java.util.Collection;
-import org.apache.openejb.test.entity.cmr.CompoundPK;
+public abstract class QueryBean implements EntityBean {
+ public abstract Integer getId();
+ public abstract void setId(Integer id);
+ public void setEntityContext(EntityContext ctx) {
+ }
-/**
- *
- * @version $Revision: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $
- */
-public abstract class ABean implements EntityBean {
+ public void unsetEntityContext() {
+ }
- private EntityContext context;
-
- // CMP
- public abstract Integer getField1();
- public abstract void setField1(Integer field1);
+ public void ejbActivate() {
+ }
- public abstract String getField2();
- public abstract void setField2(String field2);
-
- public Integer ejbCreate(Integer field1) throws CreateException {
- setField1(field1);
- return null;
+ public void ejbPassivate() {
}
- public void ejbPostCreate(Integer field1) {
+ public void ejbLoad() {
}
- public CompoundPK ejbCreate(CompoundPK compoundPK) throws CreateException {
- setField1(compoundPK.field1);
- setField2(compoundPK.field2);
- return null;
+ public void ejbStore() {
}
- public void ejbPostCreate(CompoundPK compoundPK) {
+ public void ejbRemove() {
}
- public void setEntityContext(EntityContext ctx) {
- context = ctx;
+ /**
+ * Select a single string field
+ */
+ public String ejbHomeSelectSingleStringField(String value) throws FinderException {
+ return ejbSelectSingleStringField(value);
}
- public void unsetEntityContext() {
- context = null;
+ public abstract String ejbSelectSingleStringField(String value) throws FinderException;
+
+ /**
+ * Select a single boolean field
+ */
+ public boolean ejbHomeSelectSingleBooleanField(boolean value) throws FinderException {
+ return ejbSelectSingleBooleanField(value);
}
- public void ejbActivate() {
+ public abstract boolean ejbSelectSingleBooleanField(boolean value) throws FinderException;
+
+ /**
+ * Select a single char field
+ */
+ public char ejbHomeSelectSingleCharField(char value) throws FinderException {
+ return ejbSelectSingleCharField(value);
}
- public void ejbPassivate() {
+ public abstract char ejbSelectSingleCharField(char value) throws FinderException;
+
+ /**
+ * Select a single byte field
+ */
+ public byte ejbHomeSelectSingleByteField(byte value) throws FinderException {
+ return ejbSelectSingleByteField(value);
}
- public void ejbLoad() {
+ public abstract byte ejbSelectSingleByteField(byte value) throws FinderException;
+
+ /**
+ * Select a single short field
+ */
+ public short ejbHomeSelectSingleShortField(short value) throws FinderException {
+ return ejbSelectSingleShortField(value);
}
- public void ejbStore() {
+ public abstract short ejbSelectSingleShortField(short value) throws FinderException;
+
+ /**
+ * Select a single int field
+ */
+ public int ejbHomeSelectSingleIntField(int value) throws FinderException {
+ return ejbSelectSingleIntField(value);
}
- public void ejbRemove() throws RemoveException {
+ public abstract int ejbSelectSingleIntField(int value) throws FinderException;
+
+ /**
+ * Select a single long field
+ */
+ public long ejbHomeSelectSingleLongField(long value) throws FinderException {
+ return ejbSelectSingleLongField(value);
}
-
- public ALocal ejbHomeSelectTest(String test) throws FinderException {
- return ejbSelectTest(test);
+
+ public abstract long ejbSelectSingleLongField(long value) throws FinderException;
+
+ /**
+ * Select a single float field
+ */
+ public float ejbHomeSelectSingleFloatField(float value) throws FinderException {
+ return ejbSelectSingleFloatField(value);
}
-
- public abstract ALocal ejbSelectTest(String test) throws FinderException;
+
+ public abstract float ejbSelectSingleFloatField(float value) throws FinderException;
+
+ /**
+ * Select a single double field
+ */
+ public double ejbHomeSelectSingleDoubleField(double value) throws FinderException {
+ return ejbSelectSingleDoubleField(value);
+ }
+
+ public abstract double ejbSelectSingleDoubleField(double value) throws FinderException;
+
+ /**
+ * Select a collection string field
+ */
+ public Collection ejbHomeSelectCollectionStringField() throws FinderException {
+ return ejbSelectCollectionStringField();
+ }
+
+ public abstract Collection ejbSelectCollectionStringField() throws FinderException;
+
+ /**
+ * Select a collection boolean field
+ */
+ public Collection ejbHomeSelectCollectionBooleanField() throws FinderException {
+ return ejbSelectCollectionBooleanField();
+ }
+
+ public abstract Collection ejbSelectCollectionBooleanField() throws FinderException;
+
+ /**
+ * Select a collection char field
+ */
+ public Collection ejbHomeSelectCollectionCharField() throws FinderException {
+ return ejbSelectCollectionCharField();
+ }
+
+ public abstract Collection ejbSelectCollectionCharField() throws FinderException;
+
+ /**
+ * Select a collection byte field
+ */
+ public Collection ejbHomeSelectCollectionByteField() throws FinderException {
+ return ejbSelectCollectionByteField();
+ }
+
+ public abstract Collection ejbSelectCollectionByteField() throws FinderException;
+
+ /**
+ * Select a collection short field
+ */
+ public Collection ejbHomeSelectCollectionShortField() throws FinderException {
+ return ejbSelectCollectionShortField();
+ }
+
+ public abstract Collection ejbSelectCollectionShortField() throws FinderException;
+
+ /**
+ * Select a collection int field
+ */
+ public Collection ejbHomeSelectCollectionIntField() throws FinderException {
+ return ejbSelectCollectionIntField();
+ }
+
+ public abstract Collection ejbSelectCollectionIntField() throws FinderException;
+
+ /**
+ * Select a collection long field
+ */
+ public Collection ejbHomeSelectCollectionLongField() throws FinderException {
+ return ejbSelectCollectionLongField();
+ }
+
+ public abstract Collection ejbSelectCollectionLongField() throws FinderException;
+
+ /**
+ * Select a collection float field
+ */
+ public Collection ejbHomeSelectCollectionFloatField() throws FinderException {
+ return ejbSelectCollectionFloatField();
+ }
+
+ public abstract Collection ejbSelectCollectionFloatField() throws FinderException;
+
+ /**
+ * Select a collection double field
+ */
+ public Collection ejbHomeSelectCollectionDoubleField() throws FinderException {
+ return ejbSelectCollectionDoubleField();
+ }
+
+ public abstract Collection ejbSelectCollectionDoubleField() throws FinderException;
+
+ /**
+ * Select a single local ejb
+ */
+ public Object ejbHomeSelectSingleLocalEjb(int value) throws FinderException {
+ return ejbSelectSingleLocalEjb(value);
+ }
+
+ public abstract Object ejbSelectSingleLocalEjb(int value) throws FinderException;
+
+ /**
+ * Select a single remote ejb
+ */
+ public Object ejbHomeSelectSingleRemoteEjb(int value) throws FinderException {
+ return ejbSelectSingleRemoteEjb(value);
+ }
+
+ public abstract Object ejbSelectSingleRemoteEjb(int value) throws FinderException;
+
+ /**
+ * Select a collection local ejb
+ */
+ public Collection ejbHomeSelectCollectionLocalEjb() throws FinderException {
+ return ejbSelectCollectionLocalEjb();
+ }
+
+ public abstract Collection ejbSelectCollectionLocalEjb() throws FinderException;
+
+ /**
+ * Select a collection remote ejb
+ */
+ public Collection ejbHomeSelectCollectionRemoteEjb() throws FinderException {
+ return ejbSelectCollectionRemoteEjb();
+ }
+
+ public abstract Collection ejbSelectCollectionRemoteEjb() throws FinderException;
}
Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataBean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataBean.java?view=auto&rev=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataBean.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataBean.java Wed Mar 28 21:28:38 2007
@@ -0,0 +1,91 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.entity.ejbql;
+
+import javax.ejb.EntityBean;
+import javax.ejb.EntityContext;
+
+public abstract class QueryDataBean implements EntityBean {
+ public abstract Integer getId();
+ public abstract void setId(Integer id);
+
+ public abstract boolean getBooleanField();
+ public abstract void setBooleanField(boolean value);
+
+ public abstract char getCharField();
+ public abstract void setCharField(char value);
+
+ public abstract byte getByteField();
+ public abstract void setByteField(byte value);
+
+ public abstract short getShortField();
+ public abstract void setShortField(short value);
+
+ public abstract int getIntField();
+ public abstract void setIntField(int value);
+
+ public abstract long getLongField();
+ public abstract void setLongField(long value);
+
+ public abstract float getFloatField();
+ public abstract void setFloatField(float value);
+
+ public abstract double getDoubleField();
+ public abstract void setDoubleField(double value);
+
+ public abstract String getStringField();
+ public abstract void setStringField(String value);
+
+ public Integer ejbCreate(int value) {
+ setId(value);
+ setBooleanField(value % 2 != 0);
+ setCharField((char) ('0' + value));
+ setByteField((byte) value);
+ setShortField((short) value);
+ setIntField(value);
+ setLongField(value);
+ setFloatField(value);
+ setDoubleField(value);
+ setStringField("" + value);
+ return null;
+ }
+
+ public void ejbPostCreate(int field) {
+ }
+
+ public void setEntityContext(EntityContext ctx) {
+ }
+
+ public void unsetEntityContext() {
+ }
+
+ public void ejbActivate() {
+ }
+
+ public void ejbPassivate() {
+ }
+
+ public void ejbLoad() {
+ }
+
+ public void ejbStore() {
+ }
+
+ public void ejbRemove() {
+ }
+}
Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataHome.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataHome.java?view=auto&rev=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataHome.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataHome.java Wed Mar 28 21:28:38 2007
@@ -0,0 +1,27 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.entity.ejbql;
+
+import javax.ejb.EJBHome;
+import javax.ejb.FinderException;
+import java.rmi.RemoteException;
+
+public interface QueryDataHome extends EJBHome {
+ public QueryDataRemote create(int value) throws FinderException, RemoteException;
+ public QueryDataRemote findByPrimaryKey(Integer primaryKey) throws FinderException, RemoteException;
+}
Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataLocal.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataLocal.java?view=auto&rev=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataLocal.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataLocal.java Wed Mar 28 21:28:38 2007
@@ -0,0 +1,53 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.entity.ejbql;
+
+import javax.ejb.EJBLocalObject;
+
+public interface QueryDataLocal extends EJBLocalObject {
+ public Integer getId();
+ public void setId(Integer id);
+
+ public boolean getBooleanField();
+ public void setBooleanField(boolean value);
+
+ public char getCharField();
+ public void setCharField(char value);
+
+ public byte getByteField();
+ public void setByteField(byte value);
+
+ public short getShortField();
+ public void setShortField(short value);
+
+ public int getIntField();
+ public void setIntField(int value);
+
+ public long getLongField();
+ public void setLongField(long value);
+
+ public float getFloatField();
+ public void setFloatField(float value);
+
+ public double getDoubleField();
+ public void setDoubleField(double value);
+
+ public String getStringField();
+ public void setStringField(String value);
+
+}
Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataLocalHome.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataLocalHome.java?view=auto&rev=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataLocalHome.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataLocalHome.java Wed Mar 28 21:28:38 2007
@@ -0,0 +1,26 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.entity.ejbql;
+
+import javax.ejb.EJBLocalHome;
+import javax.ejb.FinderException;
+
+public interface QueryDataLocalHome extends EJBLocalHome {
+ public QueryDataLocal create(int value) throws FinderException;
+ public QueryDataLocal findByPrimaryKey(Integer primaryKey) throws FinderException;
+}
Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataRemote.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataRemote.java?view=auto&rev=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataRemote.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryDataRemote.java Wed Mar 28 21:28:38 2007
@@ -0,0 +1,53 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.entity.ejbql;
+
+import javax.ejb.EJBObject;
+import java.rmi.RemoteException;
+
+public interface QueryDataRemote extends EJBObject {
+ public Integer getId() throws RemoteException;
+ public void setId(Integer id) throws RemoteException;
+
+ public boolean getBooleanField() throws RemoteException;
+ public void setBooleanField(boolean value) throws RemoteException;
+
+ public char getCharField() throws RemoteException;
+ public void setCharField(char value) throws RemoteException;
+
+ public byte getByteField() throws RemoteException;
+ public void setByteField(byte value) throws RemoteException;
+
+ public short getShortField() throws RemoteException;
+ public void setShortField(short value) throws RemoteException;
+
+ public int getIntField() throws RemoteException;
+ public void setIntField(int value) throws RemoteException;
+
+ public long getLongField() throws RemoteException;
+ public void setLongField(long value) throws RemoteException;
+
+ public float getFloatField() throws RemoteException;
+ public void setFloatField(float value) throws RemoteException;
+
+ public double getDoubleField() throws RemoteException;
+ public void setDoubleField(double value) throws RemoteException;
+
+ public String getStringField() throws RemoteException;
+ public void setStringField(String value) throws RemoteException;
+}
Copied: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryHome.java (from r522662, incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/AHome.java)
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryHome.java?view=diff&rev=523552&p1=incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/AHome.java&r1=522662&p2=incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryHome.java&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/AHome.java (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryHome.java Wed Mar 28 21:28:38 2007
@@ -17,26 +17,121 @@
package org.apache.openejb.test.entity.ejbql;
import java.rmi.RemoteException;
+import java.util.Collection;
-import javax.ejb.CreateException;
import javax.ejb.EJBHome;
import javax.ejb.FinderException;
-import org.apache.openejb.test.entity.cmr.CompoundPK;
+public interface QueryHome extends EJBHome {
+ public QueryRemote findByPrimaryKey(Integer primaryKey) throws FinderException, RemoteException;
-
-/**
- *
- * @version $Revision: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $
- */
-public interface AHome extends EJBHome {
-
- // Create
- public ARemote create(Integer field1) throws CreateException, RemoteException;
- public ARemote create(CompoundPK primaryKey) throws CreateException, RemoteException;
-
- // Finder
- public ARemote findByPrimaryKey(Integer primaryKey) throws FinderException, RemoteException;
- public ARemote findTest(String value) throws FinderException, RemoteException;
-
+ /**
+ * Select a single string field
+ */
+ public abstract String selectSingleStringField(String value) throws FinderException, RemoteException;
+
+ /**
+ * Select a single boolean field
+ */
+ public abstract boolean selectSingleBooleanField(boolean value) throws FinderException, RemoteException;
+
+ /**
+ * Select a single char field
+ */
+ public abstract char selectSingleCharField(char value) throws FinderException, RemoteException;
+
+ /**
+ * Select a single byte field
+ */
+ public abstract byte selectSingleByteField(byte value) throws FinderException, RemoteException;
+
+ /**
+ * Select a single short field
+ */
+ public abstract short selectSingleShortField(short value) throws FinderException, RemoteException;
+
+ /**
+ * Select a single int field
+ */
+ public abstract int selectSingleIntField(int value) throws FinderException, RemoteException;
+
+ /**
+ * Select a single long field
+ */
+ public abstract long selectSingleLongField(long value) throws FinderException, RemoteException;
+
+ /**
+ * Select a single float field
+ */
+ public abstract float selectSingleFloatField(float value) throws FinderException, RemoteException;
+
+ /**
+ * Select a single double field
+ */
+ public abstract double selectSingleDoubleField(double value) throws FinderException, RemoteException;
+
+ /**
+ * Select a collection string field
+ */
+ public abstract Collection selectCollectionStringField() throws FinderException, RemoteException;
+
+ /**
+ * Select a collection boolean field
+ */
+ public abstract Collection selectCollectionBooleanField() throws FinderException, RemoteException;
+
+ /**
+ * Select a collection char field
+ */
+ public abstract Collection selectCollectionCharField() throws FinderException, RemoteException;
+
+ /**
+ * Select a collection byte field
+ */
+ public abstract Collection selectCollectionByteField() throws FinderException, RemoteException;
+
+ /**
+ * Select a collection short field
+ */
+ public abstract Collection selectCollectionShortField() throws FinderException, RemoteException;
+
+ /**
+ * Select a collection int field
+ */
+ public abstract Collection selectCollectionIntField() throws FinderException, RemoteException;
+
+ /**
+ * Select a collection long field
+ */
+ public abstract Collection selectCollectionLongField() throws FinderException, RemoteException;
+
+ /**
+ * Select a collection float field
+ */
+ public abstract Collection selectCollectionFloatField() throws FinderException, RemoteException;
+
+ /**
+ * Select a collection double field
+ */
+ public abstract Collection selectCollectionDoubleField() throws FinderException, RemoteException;
+
+ /**
+ * Select a single local ejb
+ */
+ public abstract Object selectSingleLocalEjb(int value) throws FinderException, RemoteException;
+
+ /**
+ * Select a single remote ejb
+ */
+ public abstract Object selectSingleRemoteEjb(int test) throws FinderException, RemoteException;
+
+ /**
+ * Select a collection local ejb
+ */
+ public abstract Collection selectCollectionLocalEjb() throws FinderException, RemoteException;
+
+ /**
+ * Select a collection remote ejb
+ */
+ public abstract Collection selectCollectionRemoteEjb() throws FinderException, RemoteException;
}
Copied: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryLocal.java (from r522662, incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ALocal.java)
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryLocal.java?view=diff&rev=523552&p1=incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ALocal.java&r1=522662&p2=incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryLocal.java&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ALocal.java (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryLocal.java Wed Mar 28 21:28:38 2007
@@ -18,17 +18,5 @@
import javax.ejb.EJBLocalObject;
-/**
- *
- * @version $Revision: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $
- */
-public interface ALocal extends EJBLocalObject {
-
- // CMP
- public Integer getField1();
- public void setField1(Integer field1);
-
- public String getField2();
- public void setField2(String field2);
-
+public interface QueryLocal extends EJBLocalObject {
}
Copied: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryLocalHome.java (from r522662, incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ALocalHome.java)
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryLocalHome.java?view=diff&rev=523552&p1=incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ALocalHome.java&r1=522662&p2=incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryLocalHome.java&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ALocalHome.java (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryLocalHome.java Wed Mar 28 21:28:38 2007
@@ -16,27 +16,119 @@
*/
package org.apache.openejb.test.entity.ejbql;
-import javax.ejb.CreateException;
import javax.ejb.EJBLocalHome;
import javax.ejb.FinderException;
+import java.util.Collection;
-import org.apache.openejb.test.entity.cmr.CompoundPK;
+public interface QueryLocalHome extends EJBLocalHome {
+ public QueryLocal findByPrimaryKey(Integer primaryKey) throws FinderException;
-
-/**
- *
- * @version $Revision: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $
- */
-public interface ALocalHome extends EJBLocalHome {
-
- // Create
- public ALocal create(Integer field1) throws CreateException;
- public ALocal create(CompoundPK primaryKey) throws CreateException;
-
- // Finder
- public ALocal findByPrimaryKey(Integer primaryKey) throws FinderException;
- public ALocal findTest(String value) throws FinderException;
-
- public ALocal selectTest(String test) throws FinderException;
-
-}
+ /**
+ * Select a single string field
+ */
+ public abstract String ejbSelectSingleStringField(String value) throws FinderException;
+
+ /**
+ * Select a single boolean field
+ */
+ public abstract boolean ejbSelectSingleBooleanField(boolean value) throws FinderException;
+
+ /**
+ * Select a single char field
+ */
+ public abstract char ejbSelectSingleCharField(char value) throws FinderException;
+
+ /**
+ * Select a single byte field
+ */
+ public abstract byte ejbSelectSingleByteField(byte value) throws FinderException;
+
+ /**
+ * Select a single short field
+ */
+ public abstract short ejbSelectSingleShortField(short value) throws FinderException;
+
+ /**
+ * Select a single int field
+ */
+ public abstract int ejbSelectSingleIntField(int value) throws FinderException;
+
+ /**
+ * Select a single long field
+ */
+ public abstract long ejbSelectSingleLongField(long value) throws FinderException;
+
+ /**
+ * Select a single float field
+ */
+ public abstract float ejbSelectSingleFloatField(float value) throws FinderException;
+
+ /**
+ * Select a single double field
+ */
+ public abstract double ejbSelectSingleDoubleField(double value) throws FinderException;
+
+ /**
+ * Select a collection string field
+ */
+ public abstract Collection ejbSelectCollectionStringField(String value) throws FinderException;
+
+ /**
+ * Select a collection boolean field
+ */
+ public abstract Collection ejbSelectCollectionBooleanField(boolean test) throws FinderException;
+
+ /**
+ * Select a collection char field
+ */
+ public abstract Collection ejbSelectCollectionCharField(char test) throws FinderException;
+
+ /**
+ * Select a collection byte field
+ */
+ public abstract Collection ejbSelectCollectionByteField(byte test) throws FinderException;
+
+ /**
+ * Select a collection short field
+ */
+ public abstract Collection ejbSelectCollectionShortField(short test) throws FinderException;
+
+ /**
+ * Select a collection int field
+ */
+ public abstract Collection ejbSelectCollectionIntField(int test) throws FinderException;
+
+ /**
+ * Select a collection long field
+ */
+ public abstract Collection ejbSelectCollectionLongField(long test) throws FinderException;
+
+ /**
+ * Select a collection float field
+ */
+ public abstract Collection ejbSelectCollectionFloatField(float test) throws FinderException;
+
+ /**
+ * Select a collection double field
+ */
+ public abstract Collection ejbSelectCollectionDoubleField(double test) throws FinderException;
+
+ /**
+ * Select a single local ejb
+ */
+ public abstract Object ejbSelectSingleLocalEjb(String test) throws FinderException;
+
+ /**
+ * Select a single remote ejb
+ */
+ public abstract Object ejbSelectSingleRemoteEjb(String test) throws FinderException;
+
+ /**
+ * Select a collection local ejb
+ */
+ public abstract Collection ejbSelectCollectionLocalEjb(String test) throws FinderException;
+
+ /**
+ * Select a collection remote ejb
+ */
+ public abstract Collection ejbSelectCollectionRemoteEjb(String test) throws FinderException;}
Copied: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryRemote.java (from r522662, incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ARemote.java)
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryRemote.java?view=diff&rev=523552&p1=incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ARemote.java&r1=522662&p2=incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryRemote.java&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/ARemote.java (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/ejbql/QueryRemote.java Wed Mar 28 21:28:38 2007
@@ -16,21 +16,7 @@
*/
package org.apache.openejb.test.entity.ejbql;
-import java.rmi.RemoteException;
-
import javax.ejb.EJBObject;
-/**
- *
- * @version $Revision: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $
- */
-public interface ARemote extends EJBObject {
-
- // CMP
- public Integer getField1() throws RemoteException;
- public void setField1(Integer field1) throws RemoteException;
-
- public String getField2() throws RemoteException;
- public void setField2(String field2) throws RemoteException;
-
+public interface QueryRemote extends EJBObject {
}
Modified: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/ejb-jar.xml
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/ejb-jar.xml?view=diff&rev=523552&r1=523551&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/ejb-jar.xml (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/ejb-jar.xml Wed Mar 28 21:28:38 2007
@@ -1282,6 +1282,235 @@
</entity>
<entity>
+ <ejb-name>Query</ejb-name>
+ <home>org.apache.openejb.test.entity.ejbql.QueryHome</home>
+ <remote>org.apache.openejb.test.entity.ejbql.QueryRemote</remote>
+ <local-home>org.apache.openejb.test.entity.ejbql.QueryLocalHome</local-home>
+ <local>org.apache.openejb.test.entity.ejbql.QueryLocal</local>
+ <ejb-class>org.apache.openejb.test.entity.ejbql.QueryBean</ejb-class>
+ <persistence-type>Container</persistence-type>
+ <prim-key-class>java.lang.Integer</prim-key-class>
+ <reentrant>false</reentrant>
+ <cmp-version>2.x</cmp-version>
+ <abstract-schema-name>Query</abstract-schema-name>
+ <cmp-field>
+ <field-name>id</field-name>
+ </cmp-field>
+ <primkey-field>id</primkey-field>
+ <query>
+ <query-method>
+ <method-name>ejbSelectSingleStringField</method-name>
+ <method-params>
+ <method-param>java.lang.String</method-param>
+ </method-params>
+ </query-method>
+ <ejb-ql>SELECT o.stringField FROM QueryData o WHERE o.stringField = ?1</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectSingleBooleanField</method-name>
+ <method-params>
+ <method-param>boolean</method-param>
+ </method-params>
+ </query-method>
+ <ejb-ql>SELECT o.booleanField FROM QueryData o WHERE o.booleanField = ?1</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectSingleCharField</method-name>
+ <method-params>
+ <method-param>char</method-param>
+ </method-params>
+ </query-method>
+ <ejb-ql>SELECT o.charField FROM QueryData o WHERE o.charField = ?1</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectSingleByteField</method-name>
+ <method-params>
+ <method-param>byte</method-param>
+ </method-params>
+ </query-method>
+ <ejb-ql>SELECT o.byteField FROM QueryData o WHERE o.byteField = ?1</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectSingleShortField</method-name>
+ <method-params>
+ <method-param>short</method-param>
+ </method-params>
+ </query-method>
+ <ejb-ql>SELECT o.shortField FROM QueryData o WHERE o.shortField = ?1</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectSingleIntField</method-name>
+ <method-params>
+ <method-param>int</method-param>
+ </method-params>
+ </query-method>
+ <ejb-ql>SELECT o.intField FROM QueryData o WHERE o.intField = ?1</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectSingleLongField</method-name>
+ <method-params>
+ <method-param>long</method-param>
+ </method-params>
+ </query-method>
+ <ejb-ql>SELECT o.longField FROM QueryData o WHERE o.longField = ?1</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectSingleFloatField</method-name>
+ <method-params>
+ <method-param>float</method-param>
+ </method-params>
+ </query-method>
+ <ejb-ql>SELECT o.floatField FROM QueryData o WHERE o.floatField = ?1</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectSingleDoubleField</method-name>
+ <method-params>
+ <method-param>double</method-param>
+ </method-params>
+ </query-method>
+ <ejb-ql>SELECT o.doubleField FROM QueryData o WHERE o.doubleField = ?1</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectCollectionStringField</method-name>
+ </query-method>
+ <ejb-ql>SELECT o.stringField FROM QueryData o</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectCollectionBooleanField</method-name>
+ </query-method>
+ <ejb-ql>SELECT o.booleanField FROM QueryData o</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectCollectionCharField</method-name>
+ </query-method>
+ <ejb-ql>SELECT o.charField FROM QueryData o</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectCollectionByteField</method-name>
+ </query-method>
+ <ejb-ql>SELECT o.byteField FROM QueryData o</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectCollectionShortField</method-name>
+ </query-method>
+ <ejb-ql>SELECT o.shortField FROM QueryData o</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectCollectionIntField</method-name>
+ </query-method>
+ <ejb-ql>SELECT o.intField FROM QueryData o</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectCollectionLongField</method-name>
+ </query-method>
+ <ejb-ql>SELECT o.longField FROM QueryData o</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectCollectionFloatField</method-name>
+ </query-method>
+ <ejb-ql>SELECT o.floatField FROM QueryData o</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectCollectionDoubleField</method-name>
+ </query-method>
+ <ejb-ql>SELECT o.doubleField FROM QueryData o</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectSingleLocalEjb</method-name>
+ <method-params>
+ <method-param>int</method-param>
+ </method-params>
+ </query-method>
+ <ejb-ql>SELECT Object(o) FROM QueryData o WHERE o.intField = ?1</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectSingleRemoteEjb</method-name>
+ <method-params>
+ <method-param>int</method-param>
+ </method-params>
+ </query-method>
+ <result-type-mapping>Remote</result-type-mapping>
+ <ejb-ql>SELECT Object(o) FROM QueryData o WHERE o.intField = ?1</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectCollectionLocalEjb</method-name>
+ </query-method>
+ <ejb-ql>SELECT Object(o) FROM QueryData o</ejb-ql>
+ </query>
+ <query>
+ <query-method>
+ <method-name>ejbSelectCollectionRemoteEjb</method-name>
+ </query-method>
+ <result-type-mapping>Remote</result-type-mapping>
+ <ejb-ql>SELECT Object(o) FROM QueryData o</ejb-ql>
+ </query>
+ </entity>
+ <entity>
+ <ejb-name>QueryData</ejb-name>
+ <home>org.apache.openejb.test.entity.ejbql.QueryDataHome</home>
+ <remote>org.apache.openejb.test.entity.ejbql.QueryDataRemote</remote>
+ <local-home>org.apache.openejb.test.entity.ejbql.QueryDataLocalHome</local-home>
+ <local>org.apache.openejb.test.entity.ejbql.QueryDataLocal</local>
+ <ejb-class>org.apache.openejb.test.entity.ejbql.QueryDataBean</ejb-class>
+ <persistence-type>Container</persistence-type>
+ <prim-key-class>java.lang.Integer</prim-key-class>
+ <reentrant>false</reentrant>
+ <cmp-version>2.x</cmp-version>
+ <abstract-schema-name>QueryData</abstract-schema-name>
+ <cmp-field>
+ <field-name>id</field-name>
+ </cmp-field>
+ <cmp-field>
+ <field-name>booleanField</field-name>
+ </cmp-field>
+ <cmp-field>
+ <field-name>charField</field-name>
+ </cmp-field>
+ <cmp-field>
+ <field-name>byteField</field-name>
+ </cmp-field>
+ <cmp-field>
+ <field-name>shortField</field-name>
+ </cmp-field>
+ <cmp-field>
+ <field-name>intField</field-name>
+ </cmp-field>
+ <cmp-field>
+ <field-name>longField</field-name>
+ </cmp-field>
+ <cmp-field>
+ <field-name>floatField</field-name>
+ </cmp-field>
+ <cmp-field>
+ <field-name>doubleField</field-name>
+ </cmp-field>
+ <cmp-field>
+ <field-name>stringField</field-name>
+ </cmp-field>
+ <primkey-field>id</primkey-field>
+ </entity>
+
+ <entity>
<ejb-name>OneOwningSideBean</ejb-name>
<local-home>org.apache.openejb.test.entity.cmr.cmrmapping.OneOwningSideLocalHome</local-home>
<local>org.apache.openejb.test.entity.cmr.cmrmapping.OneOwningSideLocal</local>
Modified: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/openejb-jar.xml
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/openejb-jar.xml?view=diff&rev=523552&r1=523551&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/openejb-jar.xml (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/resources/META-INF/openejb-jar.xml Wed Mar 28 21:28:38 2007
@@ -188,6 +188,8 @@
<ejb-deployment ejb-name="ComplexSong" deployment-id="client/tests/entity/cmr/oneToMany/ComplexSong" container-id="Default CMP Container"/>
<ejb-deployment ejb-name="ComplexGame" deployment-id="client/tests/entity/cmr/manyToMany/ComplexGame" container-id="Default CMP Container"/>
<ejb-deployment ejb-name="ComplexPlatform" deployment-id="client/tests/entity/cmr/manyToMany/ComplexPlatform" container-id="Default CMP Container"/>
+ <ejb-deployment ejb-name="Query" deployment-id="client/tests/entity/ejbql/Query" container-id="Default CMP Container"/>
+ <ejb-deployment ejb-name="QueryData" deployment-id="client/tests/entity/ejbql/QueryData" container-id="Default CMP Container"/>
<ejb-deployment ejb-name="OneOwningSideBean" deployment-id="client/tests/entity/cmp2/OneOwningSideBean/EJBHome" container-id="Default CMP Container"/>
<ejb-deployment ejb-name="OneInverseSideBean" deployment-id="client/tests/entity/cmp2/OneInverseSideBean/EJBHome" container-id="Default CMP Container"/>
<ejb-deployment ejb-name="ManyOwningSideBean" deployment-id="client/tests/entity/cmp2/ManyOwningSideBean/EJBHome" container-id="Default CMP Container"/>
Modified: incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/HsqldbTestDatabase.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/HsqldbTestDatabase.java?view=diff&rev=523552&r1=523551&r2=523552
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/HsqldbTestDatabase.java (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/HsqldbTestDatabase.java Wed Mar 28 21:28:38 2007
@@ -58,7 +58,7 @@
"ComplexCmp2Bean",
"UnknownCmp2Bean",
"AOBasicCmpBean",
- "AOBasicCmp2Bean",
+ "AllowedOperationsCmp2Bean",
"EncCmpBean",
"EncCmp2Bean",
"ContextLookupCmpBean",
@@ -76,6 +76,8 @@
"Platform",
"ComplexGame",
"ComplexPlatform",
+ "Query",
+ "QueryData",
};
static {