Title: [2417] trunk/openejb2/modules/core/src/java/org/openejb/entity/cmp: Added missing transaction manager object name attribute to ear deployer
- Revision
- 2417
- Author
- dain
- Date
- 2006-02-02 14:36:04 -0500 (Thu, 02 Feb 2006)
Log Message
Added missing transaction manager object name attribute to ear deployer
Added better error handling to openejb tranql intergration
Modified Paths
Diff
Modified: trunk/openejb2/modules/core/src/java/org/openejb/entity/cmp/InTxCacheInterceptor.java (2416 => 2417)
--- trunk/openejb2/modules/core/src/java/org/openejb/entity/cmp/InTxCacheInterceptor.java 2006-02-02 07:21:24 UTC (rev 2416)
+++ trunk/openejb2/modules/core/src/java/org/openejb/entity/cmp/InTxCacheInterceptor.java 2006-02-02 19:36:04 UTC (rev 2417)
@@ -55,7 +55,6 @@
import org.openejb.CmpEjbDeployment;
import org.openejb.EjbDeployment;
import org.openejb.EjbInvocation;
-import org.openejb.EntityEjbDeployment;
/**
* This interceptor defines, if required, the InTxCache of the
@@ -77,12 +76,15 @@
TransactionContext transactionContext = ejbInvocation.getTransactionContext();
if (transactionContext.getInTxCache() == null) {
EjbDeployment deployment = ejbInvocation.getEjbDeployment();
- if (!(deployment instanceof EntityEjbDeployment)) {
- throw new IllegalArgumentException("NewInTxCacheInterceptor can only be used with an EntityEjbDeploymentContext: " + deployment.getClass().getName());
+ if (!(deployment instanceof CmpEjbDeployment)) {
+ throw new IllegalArgumentException("NewInTxCacheInterceptor can only be used with an CmpEjbDeployment: " + deployment.getClass().getName());
}
CmpEjbDeployment cmpEjbDeploymentContext = ((CmpEjbDeployment) deployment);
+
Flushable inTxCache = cmpEjbDeploymentContext.getEjbCmpEngine().createInTxCache();
+ if (inTxCache == null) throw new NullPointerException("inTxCache is null");
+
transactionContext.setInTxCache(inTxCache);
}
Modified: trunk/openejb2/modules/core/src/java/org/openejb/entity/cmp/TranqlCmpField.java (2416 => 2417)
--- trunk/openejb2/modules/core/src/java/org/openejb/entity/cmp/TranqlCmpField.java 2006-02-02 07:21:24 UTC (rev 2416)
+++ trunk/openejb2/modules/core/src/java/org/openejb/entity/cmp/TranqlCmpField.java 2006-02-02 19:36:04 UTC (rev 2417)
@@ -72,14 +72,22 @@
public Object getValue(CmpInstanceContext ctx) {
CacheRow cacheRow = (CacheRow) ctx.getCmpData();
+ if (cacheRow == null) throw new NullPointerException("cacheRow is null");
+
InTxCache inTxCache = (InTxCache) ctx.getTransactionContext().getInTxCache();
+ if (inTxCache == null) throw new NullPointerException("inTxCache is null");
+
Object value = field.get(inTxCache, cacheRow);
return value;
}
public void setValue(CmpInstanceContext ctx, Object value) {
CacheRow cacheRow = (CacheRow) ctx.getCmpData();
+ if (cacheRow == null) throw new NullPointerException("cacheRow is null");
+
InTxCache inTxCache = (InTxCache) ctx.getTransactionContext().getInTxCache();
+ if (inTxCache == null) throw new NullPointerException("inTxCache is null");
+
field.set(inTxCache, cacheRow, value);
}