pmlopes 2004/10/25 08:34:39
Modified: modules/core/src/java/org/openejb/alt/containers/castor_cmp11
CastorCMP11_EntityContainer.java
Log:
Stateful passivator fix and some inner class optimizations
Revision Changes Path
1.4 +13 -13
openejb1/modules/core/src/java/org/openejb/alt/containers/castor_cmp11/CastorCMP11_EntityContainer.java
Index: CastorCMP11_EntityContainer.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb1/modules/core/src/java/org/openejb/alt/containers/castor_cmp11/CastorCMP11_EntityContainer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CastorCMP11_EntityContainer.java 26 Aug 2004 07:20:26 -0000 1.3
+++ CastorCMP11_EntityContainer.java 25 Oct 2004 12:34:39 -0000 1.4
@@ -97,7 +97,7 @@
*/
public class CastorCMP11_EntityContainer
implements RpcContainer, TransactionContainer, CallbackInterceptor, InstanceFactory
{
-
+
/*
* Bean instances that are currently in use are placed in the txReadyPoolMap
indexed
@@ -222,7 +222,7 @@
protected HashMap resetMap;
private Properties props;
-
+
//DMB:TODO:1: make logger for life cycle info.
/**
@@ -370,24 +370,24 @@
* held by the deployment descriptor. The container is required to
generate this query
* automatically, which is what this code does.
*/
- String findByPrimarKeyQuery = "SELECT e FROM " +
di.getBeanClass().getName() + " e WHERE ";
+ StringBuffer findByPrimarKeyQuery = new StringBuffer("SELECT e FROM
" + di.getBeanClass().getName() + " e WHERE ");
if ( kg.isKeyComplex() ) {
Field[] pkFields = di.getPrimaryKeyClass().getFields();
for ( int i = 1; i <= pkFields.length; i++ ) {
- findByPrimarKeyQuery += "e." + pkFields[i - 1].getName() +
" = $" + i;
+ findByPrimarKeyQuery.append("e." + pkFields[i -
1].getName() + " = $" + i);
if ( ( i + 1 ) <= pkFields.length )
- findByPrimarKeyQuery += " AND ";
+ findByPrimarKeyQuery.append(" AND ");
}
} else {
- findByPrimarKeyQuery += "e." +
di.getPrimaryKeyField().getName() + " = $1";
+ findByPrimarKeyQuery.append("e." +
di.getPrimaryKeyField().getName() + " = $1");
}
Method findByPrimaryKeyMethod = di.getHomeInterface().getMethod(
"findByPrimaryKey", new Class[]{di.getPrimaryKeyClass()} );
- di.addQuery( findByPrimaryKeyMethod, findByPrimarKeyQuery );
+ di.addQuery( findByPrimaryKeyMethod,
findByPrimarKeyQuery.toString() );
} catch ( Exception e ) {
throw new org.openejb.SystemException( "Could not generate a query
statement for the findByPrimaryKey method of the deployment = " +
di.getDeploymentID(), e );
}
@@ -402,7 +402,7 @@
resetMap.put( float.class, new Float( 0 ) );
resetMap.put( double.class, new Double( 0.0 ) );
}
-
+
boolean initialized;
protected void postInit() {
if (initialized) return;
@@ -515,7 +515,7 @@
// process home interface methods
Class declaringClass = callMethod.getDeclaringClass();
String methodName = callMethod.getName();
-
+
if (EJBHome.class.isAssignableFrom(declaringClass) ||
EJBLocalHome.class.isAssignableFrom(declaringClass) ){
if ( declaringClass != EJBHome.class ) {
// Its a home interface method, which is declared by the bean
provider, but not a EJBHome method.
@@ -1558,7 +1558,7 @@
public void updated( Object object ) {
}
- public class Key {
+ public static class Key {
Object deploymentID, primaryKey;
Transaction transaction;
@@ -1613,4 +1613,4 @@
}
-}
+}
\ No newline at end of file