gdamour     2005/08/19 23:49:06

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

  o GERONIMO-675 CMR / CMP Fields should not be read-only
  
  Some additional enhancement to support the scenario where a primary key column
  is also a foreign key column.
  
  This basically implements the rules that Jeremy was recommending to apply
  in such a case:
  
  when the primary key is set in the ejbCreate<Method> the associated CMR field,
  i.e. the CMR mapped to the foreign key column, is marked as under 
construction.
  
  From this point, the CMR must be set before the commit of the current
  transaction. If not set, then the transaction is marked as rolled back.
  
  Also, if an attempt is made to reset the pk field by relating the entity to
  the wrong entity, an IllegalStateException is thrown.
  
  o Also sync the code with the refactoring of the Association and 
AssociationEnd
  classes: the Association.isOneToOne, isOneToMany, isManyToOne and
  isManyToMany methods have been moved to AssociationEnd.
  
  Revision  Changes    Path
  1.9       +6 -5      
openejb/modules/core/src/java/org/openejb/entity/cmp/CMPRemoveMethod.java
  
  Index: CMPRemoveMethod.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/cmp/CMPRemoveMethod.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- CMPRemoveMethod.java      14 Feb 2005 18:32:30 -0000      1.8
  +++ CMPRemoveMethod.java      20 Aug 2005 03:49:05 -0000      1.9
  @@ -151,7 +151,11 @@
                   Collection entities = (Collection) 
cascadeManyDeleteFields[i].get(cache, cacheRow);
                   cascadeDeleteEntities.addAll(entities);
               }
  -            
  +
  +            // delete this row in the persistence engine
  +            cacheRow.markRemoved();
  +            cache.remove(cacheRow);
  +
               // remove entity from all relationships
               for (int i = 0; i < cmrOneFields.length; i++) {
                   cmrOneFields[i].set(cache, cacheRow, null);
  @@ -160,9 +164,6 @@
                   cmrManyFields[i].set(cache, cacheRow, Collections.EMPTY_SET);
               }
   
  -            // delete this row in the persistence engine
  -            cacheRow.markRemoved();
  -            cache.remove(cacheRow);
   
               // clear id and row data from the instance
               ctx.setId(null);
  
  
  

Reply via email to