cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johnth...@apache.org
Subject svn commit: r1552452 - in /cayenne/main/trunk/cayenne-server/src: main/java/org/apache/cayenne/dba/db2/ main/java/org/apache/cayenne/dba/frontbase/ main/java/org/apache/cayenne/dba/h2/ main/java/org/apache/cayenne/dba/oracle/ main/java/org/apache/cayen...
Date Thu, 19 Dec 2013 23:17:16 GMT
Author: johnthuss
Date: Thu Dec 19 23:17:15 2013
New Revision: 1552452

URL: http://svn.apache.org/r1552452
Log:
Fix overriding starting values for several PkGenerators; fix JdbcPkGeneratorTest

Modified:
    cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/db2/DB2PkGenerator.java
    cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/frontbase/FrontBasePkGenerator.java
    cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/h2/H2PkGenerator.java
    cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java
    cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/postgres/PostgresPkGenerator.java
    cayenne/main/trunk/cayenne-server/src/test/java/org/apache/cayenne/dba/JdbcPkGeneratorTest.java

Modified: cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/db2/DB2PkGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/db2/DB2PkGenerator.java?rev=1552452&r1=1552451&r2=1552452&view=diff
==============================================================================
--- cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/db2/DB2PkGenerator.java
(original)
+++ cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/db2/DB2PkGenerator.java
Thu Dec 19 23:17:15 2013
@@ -194,7 +194,7 @@ public class DB2PkGenerator extends Jdbc
      */
     protected String createSequenceString(DbEntity entity) {
         StringBuilder buf = new StringBuilder();
-        buf.append("CREATE SEQUENCE ").append(sequenceName(entity)).append(" START WITH 200").append("
INCREMENT BY ")
+        buf.append("CREATE SEQUENCE ").append(sequenceName(entity)).append(" START WITH ").append(pkStartValue).append("
INCREMENT BY ")
                 .append(getPkCacheSize()).append(" NO MAXVALUE ").append(" NO CYCLE ").append("
CACHE ")
                 .append(getPkCacheSize());
         return buf.toString();

Modified: cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/frontbase/FrontBasePkGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/frontbase/FrontBasePkGenerator.java?rev=1552452&r1=1552451&r2=1552452&view=diff
==============================================================================
--- cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/frontbase/FrontBasePkGenerator.java
(original)
+++ cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/frontbase/FrontBasePkGenerator.java
Thu Dec 19 23:17:15 2013
@@ -40,6 +40,7 @@ public class FrontBasePkGenerator extend
 
     public FrontBasePkGenerator(JdbcAdapter adapter) {
         super(adapter);
+        pkStartValue = 1000000;
     }
 
     /**
@@ -84,7 +85,7 @@ public class FrontBasePkGenerator extend
     @Override
     protected String pkCreateString(String entName) {
         StringBuilder buf = new StringBuilder();
-        buf.append("SET UNIQUE = 1000000 FOR \"").append(entName).append("\"");
+        buf.append("SET UNIQUE = ").append(pkStartValue).append(" FOR \"").append(entName).append("\"");
         return buf.toString();
     }
 

Modified: cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/h2/H2PkGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/h2/H2PkGenerator.java?rev=1552452&r1=1552451&r2=1552452&view=diff
==============================================================================
--- cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/h2/H2PkGenerator.java
(original)
+++ cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/h2/H2PkGenerator.java
Thu Dec 19 23:17:15 2013
@@ -48,7 +48,8 @@ public class H2PkGenerator extends Oracl
     @Override
     protected String createSequenceString(DbEntity ent) {
         StringBuilder buf = new StringBuilder();
-        buf.append("CREATE SEQUENCE ").append(sequenceName(ent)).append(" START WITH 200")
+        buf.append("CREATE SEQUENCE ").append(sequenceName(ent))
+        	.append(" START WITH ").append(pkStartValue)
         	.append(" INCREMENT BY ").append(pkCacheSize(ent)).append(" CACHE 1");
         return buf.toString();
     }

Modified: cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java?rev=1552452&r1=1552451&r2=1552452&view=diff
==============================================================================
--- cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java
(original)
+++ cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java
Thu Dec 19 23:17:15 2013
@@ -125,7 +125,7 @@ public class OraclePkGenerator extends J
 
     protected String createSequenceString(DbEntity ent) {
         StringBuilder buf = new StringBuilder();
-        buf.append("CREATE SEQUENCE ").append(sequenceName(ent)).append(" START WITH 200").append("
INCREMENT BY ")
+        buf.append("CREATE SEQUENCE ").append(sequenceName(ent)).append(" START WITH ").append(pkStartValue).append("
INCREMENT BY ")
                 .append(pkCacheSize(ent));
         return buf.toString();
     }

Modified: cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/postgres/PostgresPkGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/postgres/PostgresPkGenerator.java?rev=1552452&r1=1552451&r2=1552452&view=diff
==============================================================================
--- cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/postgres/PostgresPkGenerator.java
(original)
+++ cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/dba/postgres/PostgresPkGenerator.java
Thu Dec 19 23:17:15 2013
@@ -52,7 +52,7 @@ public class PostgresPkGenerator extends
         // that works with all tested versions.
         StringBuilder buf = new StringBuilder();
         buf.append("CREATE SEQUENCE ").append(sequenceName(ent)).append(" INCREMENT ").append(pkCacheSize(ent))
-                .append(" START 200");
+                .append(" START ").append(pkStartValue);
         return buf.toString();
     }
 

Modified: cayenne/main/trunk/cayenne-server/src/test/java/org/apache/cayenne/dba/JdbcPkGeneratorTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/cayenne-server/src/test/java/org/apache/cayenne/dba/JdbcPkGeneratorTest.java?rev=1552452&r1=1552451&r2=1552452&view=diff
==============================================================================
--- cayenne/main/trunk/cayenne-server/src/test/java/org/apache/cayenne/dba/JdbcPkGeneratorTest.java
(original)
+++ cayenne/main/trunk/cayenne-server/src/test/java/org/apache/cayenne/dba/JdbcPkGeneratorTest.java
Thu Dec 19 23:17:15 2013
@@ -50,6 +50,9 @@ public class JdbcPkGeneratorTest extends
         JdbcPkGenerator pkGenerator = (JdbcPkGenerator) adapter.getPkGenerator();
 
         pkGenerator.setPkStartValue(Integer.MAX_VALUE * 2l);
+        if (!JdbcPkGenerator.class.equals(adapter.getPkGenerator().getClass())) { // AUTO_PK_SUPPORT
doesn't allow dropping PK support for a single entity
+            pkGenerator.dropAutoPk(node, Collections.singletonList(artistEntity));
+        }
         pkGenerator.createAutoPk(node, Collections.singletonList(artistEntity));
         pkGenerator.reset();
 



Mime
View raw message