gdamour     2005/08/19 23:49:06

  Modified:    modules/itests/src/itest/org/openejb/test
                        DerbyTestDatabase.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.6       +28 -1     
openejb/modules/itests/src/itest/org/openejb/test/DerbyTestDatabase.java
  
  Index: DerbyTestDatabase.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/itests/src/itest/org/openejb/test/DerbyTestDatabase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DerbyTestDatabase.java    29 Jul 2005 22:29:44 -0000      1.5
  +++ DerbyTestDatabase.java    20 Aug 2005 03:49:06 -0000      1.6
  @@ -85,6 +85,18 @@
   
       private static final String DROP_STORAGE = "DROP TABLE storage";
   
  +    private static final String CREATE_ONE_OWNING = "CREATE TABLE oneowning 
(id INTEGER, field1 INTEGER)";
  +
  +    private static final String DROP_ONE_OWNING = "DROP TABLE oneowning";
  +
  +    private static final String CREATE_ONE_INVERSE = "CREATE TABLE 
oneinverse (id INTEGER)";
  +
  +    private static final String DROP_ONE_INVERSE = "DROP TABLE oneinverse";
  +
  +    private static final String CREATE_MANY_OWNING = "CREATE TABLE 
manyowning (id INTEGER, field1 INTEGER)";
  +
  +    private static final String DROP_MANY_OWNING = "DROP TABLE manyowning";
  +
       private static final String CREATE_SEQUENCE_TABLE = "CREATE TABLE 
SEQUENCE_TABLE (ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, 
INCREMENT BY 1), DUMMY INT)";
   
       private static final String DROP_SEQUENCE_TABLE = "DROP TABLE 
SEQUENCE_TABLE";
  @@ -136,6 +148,15 @@
           executeStatementIgnoreErrors(DROP_STORAGE);
           executeStatement(CREATE_STORAGE);
   
  +        executeStatementIgnoreErrors(DROP_ONE_OWNING);
  +        executeStatement(CREATE_ONE_OWNING);
  +        
  +        executeStatementIgnoreErrors(DROP_ONE_INVERSE);
  +        executeStatement(CREATE_ONE_INVERSE);
  +        
  +        executeStatementIgnoreErrors(DROP_MANY_OWNING);
  +        executeStatement(CREATE_MANY_OWNING);
  +
           executeStatementIgnoreErrors(DROP_SEQUENCE_TABLE);
           executeStatement(CREATE_SEQUENCE_TABLE);
       }
  @@ -150,6 +171,12 @@
           executeStatementIgnoreErrors(DROP_ORDER);
   
           executeStatementIgnoreErrors(DROP_PRODUCT);
  +
  +        executeStatementIgnoreErrors(DROP_ONE_OWNING);
  +        
  +        executeStatementIgnoreErrors(DROP_ONE_INVERSE);
  +        
  +        executeStatementIgnoreErrors(DROP_MANY_OWNING);
   
           executeStatementIgnoreErrors(DROP_SEQUENCE_TABLE);
       }
  
  
  

Reply via email to