openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r680501 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ openjpa-kernel/src/main/java/org/apache/openjpa/meta/
Date Mon, 28 Jul 2008 21:12:17 GMT
Author: mikedd
Date: Mon Jul 28 14:12:17 2008
New Revision: 680501

URL: http://svn.apache.org/viewvc?rev=680501&view=rev
Log:
OPENJPA-669 DBDictionary can specify the type of native sequences.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/NativeJDBCSeq.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/NativeJDBCSeq.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/NativeJDBCSeq.java?rev=680501&r1=680500&r2=680501&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/NativeJDBCSeq.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/NativeJDBCSeq.java
Mon Jul 28 14:12:17 2008
@@ -42,6 +42,7 @@
 import org.apache.openjpa.lib.util.Options;
 import org.apache.openjpa.util.MetaDataException;
 import org.apache.openjpa.util.UserException;
+
 import serp.util.Numbers;
 import serp.util.Strings;
 
@@ -98,6 +99,7 @@
      * @deprecated Use {@link #setSequence}. Retained for
      * backwards-compatibility for auto-configuration.
      */
+    @Deprecated
     public void setSequenceName(String seqName) {
         setSequence(seqName);
     }
@@ -147,6 +149,7 @@
     /**
      * @deprecated Retained for backwards-compatibility for auto-configuration.
      */
+    @Deprecated
     public void setTableName(String table) {
         _tableName = table;
     }
@@ -154,11 +157,13 @@
     /**
      * @deprecated Retained for backwards-compatibility for auto-configuration.
      */
+    @Deprecated
     public void setFormat(String format) {
         _format = format;
         _subTable = true;
     }
 
+    @Override
     public void addSchema(ClassMapping mapping, SchemaGroup group) {
         // sequence already exists?
         if (group.isKnownSequence(_seqName))
@@ -175,6 +180,7 @@
         schema.importSequence(_seq);
     }
 
+    @Override
     public JDBCConfiguration getConfiguration() {
         return _conf;
     }
@@ -202,8 +208,11 @@
         Object[] subs = (_subTable) ? new Object[]{ name, _tableName }
             : new Object[]{ name };
         _select = MessageFormat.format(_format, subs);
+        
+        type = dict.nativeSequenceType;
     }
     
+    @Override
     protected Object nextInternal(JDBCStore store, ClassMapping mapping)
         throws SQLException {
         Connection conn = getConnection(store);

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?rev=680501&r1=680500&r2=680501&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
Mon Jul 28 14:12:17 2008
@@ -89,6 +89,7 @@
 import org.apache.openjpa.jdbc.schema.Unique;
 import org.apache.openjpa.kernel.Filters;
 import org.apache.openjpa.kernel.OpenJPAStateManager;
+import org.apache.openjpa.kernel.Seq;
 import org.apache.openjpa.kernel.exps.Path;
 import org.apache.openjpa.lib.conf.Configurable;
 import org.apache.openjpa.lib.conf.Configuration;
@@ -327,6 +328,8 @@
     public String sequenceSQL = null;
     public String sequenceSchemaSQL = null;
     public String sequenceNameSQL = null;
+    // most native sequences can be run inside the business transaction
+    public int nativeSequenceType= Seq.TYPE_CONTIGUOUS;
 
     protected JDBCConfiguration conf = null;
     protected Log log = null;

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java?rev=680501&r1=680500&r2=680501&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java
Mon Jul 28 14:12:17 2008
@@ -270,7 +270,8 @@
                     J2DoPrivHelper.newInstanceAction(cls));
                 Configurations.configureInstance(seq,
                     _repos.getConfiguration(), props.toString());
-                seq.setType(_type);
+                if(_type != Seq.TYPE_DEFAULT)
+                    seq.setType(_type);
             } else if (_factory != null)
                 seq = _factory.toSequence(cls, props.toString());
             else
@@ -339,6 +340,7 @@
             }
     }
 
+    @Override
     public String toString() {
         return _name;
     }



Mime
View raw message