cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgen...@apache.org
Subject svn commit: r1002113 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/h2/H2Adapter.java
Date Tue, 28 Sep 2010 10:53:56 GMT
Author: mgentry
Date: Tue Sep 28 10:53:56 2010
New Revision: 1002113

URL: http://svn.apache.org/viewvc?rev=1002113&view=rev
Log:
Updated the H2 Adapter to support auto-generating primary keys through H2's AUTO_INCREMENT
option.

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/h2/H2Adapter.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/h2/H2Adapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/h2/H2Adapter.java?rev=1002113&r1=1002112&r2=1002113&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/h2/H2Adapter.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/h2/H2Adapter.java
Tue Sep 28 10:53:56 2010
@@ -20,16 +20,28 @@
 package org.apache.cayenne.dba.h2;
 
 import org.apache.cayenne.dba.JdbcAdapter;
+import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.merge.MergerFactory;
 
 /**
  * @since 3.0
  */
 public class H2Adapter extends JdbcAdapter {
-	
+    public H2Adapter() {
+        setSupportsGeneratedKeys(true);
+    }
+
     @Override
     public MergerFactory mergerFactory() {
         return new H2MergerFactory();
     }
 
+    @Override
+    public void createTableAppendColumn(StringBuffer sqlBuffer, DbAttribute column) {
+        super.createTableAppendColumn(sqlBuffer, column);
+
+        if (column.isGenerated()) {
+            sqlBuffer.append(" AUTO_INCREMENT");
+        }
+    }
 }



Mime
View raw message