You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2005/04/17 12:45:43 UTC

cvs commit: db-torque/src/generator/src/java/org/apache/torque/engine/database/model Column.java

tfischer    2005/04/17 03:45:43

  Modified:    src/generator/src/dtd database.dtd
               xdocs    changes.xml
               src/generator/src/java/org/apache/torque/engine/database/model
                        Column.java
  Log:
  Set autoIncrement=true for primary keys with idMethod=native and the platform's defaultIdMethod="identity" (i.e. all databases except oracle, postgresql and sapdb).
  This behaviour can be overridden by explicitly setting autoincrement=false in the respective column
  
  Revision  Changes    Path
  1.7       +2 -2      db-torque/src/generator/src/dtd/database.dtd
  
  Index: database.dtd
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/dtd/database.dtd,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- database.dtd	9 Mar 2005 14:17:32 -0000	1.6
  +++ database.dtd	17 Apr 2005 10:45:43 -0000	1.7
  @@ -118,7 +118,7 @@
     size CDATA #IMPLIED
     scale CDATA #IMPLIED
     default CDATA #IMPLIED
  -  autoIncrement (true|false) "false"
  +  autoIncrement (true|false) #IMPLIED
     inheritance (single|false) "false"
     inputValidator CDATA #IMPLIED
     javaNamingMethod (nochange|underscore|javaname) #IMPLIED
  
  
  
  1.153     +8 -0      db-torque/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/db-torque/xdocs/changes.xml,v
  retrieving revision 1.152
  retrieving revision 1.153
  diff -u -r1.152 -r1.153
  --- changes.xml	17 Apr 2005 09:58:59 -0000	1.152
  +++ changes.xml	17 Apr 2005 10:45:43 -0000	1.153
  @@ -28,6 +28,14 @@
     <body>
   
     <release version="3.2-dev" date="in CVS">
  +    <action type="update" dev="tfischer">
  +      Unify the behaviour of primary key columns. Until now, 
  +      primary key columns were not filled automatically for
  +      idMethod=native and for platforms with
  +      default idMethod=identity (i.e. all databases exept oracle,
  +      postgresql and sapdb). Now, the default is that primary key 
  +      columns are always filled automatically by default.
  +    </action>
       <action type="fix" dev="tfischer">
         Use the cascade option for dropping tables in PostgreSQL.
         This allows to drop tables which have foreign keys.
  
  
  
  1.28      +12 -3     db-torque/src/generator/src/java/org/apache/torque/engine/database/model/Column.java
  
  Index: Column.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/database/model/Column.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- Column.java	31 Jan 2005 19:43:56 -0000	1.27
  +++ Column.java	17 Apr 2005 10:45:43 -0000	1.28
  @@ -170,8 +170,17 @@
   
           //AutoIncrement/Sequences
           String autoIncrement = attrib.getValue("autoIncrement");
  -        isAutoIncrement = ("true".equals(autoIncrement));
  -
  +        // autoincrement is false per default,
  +        // except if the column is a primary key
  +        // and the idMethod is native
  +        // and the platform's default id Method is identity
  +        // and autoIncrement is not excplicitly set to false
  +        isAutoIncrement = ("true".equals(autoIncrement)
  +                || (isPrimaryKey()
  +                    && IDMethod.NATIVE.equals(getTable().getIdMethod())
  +                    && Platform.IDENTITY.equals(
  +                            getPlatform().getNativeIdMethod())
  +                    && (!"false".equals(autoIncrement))));
           //Default column value.
           domain.replaceDefaultValue(attrib.getValue("default"));
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org