mirror of https://github.com/apache/openjpa.git
OPENJPA-669 DBDictionary can specify the type of native sequences.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@680501 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3d81f8652f
commit
191f26d72d
|
@ -42,6 +42,7 @@ import org.apache.openjpa.lib.util.Localizer;
|
|||
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 @@ public class NativeJDBCSeq
|
|||
* @deprecated Use {@link #setSequence}. Retained for
|
||||
* backwards-compatibility for auto-configuration.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setSequenceName(String seqName) {
|
||||
setSequence(seqName);
|
||||
}
|
||||
|
@ -147,6 +149,7 @@ public class NativeJDBCSeq
|
|||
/**
|
||||
* @deprecated Retained for backwards-compatibility for auto-configuration.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setTableName(String table) {
|
||||
_tableName = table;
|
||||
}
|
||||
|
@ -154,11 +157,13 @@ public class NativeJDBCSeq
|
|||
/**
|
||||
* @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 @@ public class NativeJDBCSeq
|
|||
schema.importSequence(_seq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JDBCConfiguration getConfiguration() {
|
||||
return _conf;
|
||||
}
|
||||
|
@ -202,8 +208,11 @@ public class NativeJDBCSeq
|
|||
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);
|
||||
|
|
|
@ -89,6 +89,7 @@ import org.apache.openjpa.jdbc.schema.Table;
|
|||
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 class DBDictionary
|
|||
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;
|
||||
|
|
|
@ -270,7 +270,8 @@ public class SequenceMetaData
|
|||
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 @@ public class SequenceMetaData
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return _name;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue