gdamour     2004/11/08 10:47:27

  Modified:    modules/core/src/java/org/openejb/entity/cmp
                        CMPCreateMethod.java
  Log:

  GERONIMO-386: openejb cmp attempt to modify identity columns
  
  o create a new PrimaryKeyGenerator which uses table auto-generated primary
  key to generate the primary key of a CMP;
  o reconfigure the itests CMP EJBs to use the above PrimaryKeyGenerator; and
  o itests are now executed with Derby as the underlying database.
  
  Revision  Changes    Path
  1.10      +8 -6      
openejb/modules/core/src/java/org/openejb/entity/cmp/CMPCreateMethod.java
  
  Index: CMPCreateMethod.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/cmp/CMPCreateMethod.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- CMPCreateMethod.java      15 Oct 2004 14:56:47 -0000      1.9
  +++ CMPCreateMethod.java      8 Nov 2004 15:47:27 -0000       1.10
  @@ -161,7 +161,7 @@
           GlobalIdentity globalId;
           // Is the primary key auto-generated?
           if ( null != keyGenerator ) {
  -            Object opaque = keyGenerator.getNextPrimaryKey();
  +            Object opaque = keyGenerator.getNextPrimaryKey(cacheRow);
               globalId = primaryKeyTransform.getGlobalIdentity(opaque);
           } else {
               // define identity (may require insert to database)
  @@ -177,12 +177,14 @@
           TransactionContext transactionContext = 
invocation.getTransactionContext();
           InTxCache cache = transactionContext.getInTxCache();
   
  -        // add the row to the cache (returning a new row containing identity)
  -        cacheRow = cacheTable.addRow(cache, globalId, cacheRow);
  -
  -        // CacheRow slots do not define the identity in this case; Inject it.
           if ( null != keyGenerator ) {
  +            cacheRow = keyGenerator.updateCache(cache, globalId, cacheRow);
  +
  +            // CacheRow slots do not define the identity in this case; 
Inject it.
               identityDefiner.injectIdentity(cacheRow);
  +        } else {
  +            // add the row to the cache (returning a new row containing 
identity)
  +            cacheRow = cacheTable.addRow(cache, globalId, cacheRow);
           }
           
           ctx.setCacheRow(cacheRow);
  
  
  

Reply via email to