mirror of
https://github.com/apache/openjpa.git
synced 2025-02-08 11:06:01 +00:00
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.lib.util.Options;
|
||||||
import org.apache.openjpa.util.MetaDataException;
|
import org.apache.openjpa.util.MetaDataException;
|
||||||
import org.apache.openjpa.util.UserException;
|
import org.apache.openjpa.util.UserException;
|
||||||
|
|
||||||
import serp.util.Numbers;
|
import serp.util.Numbers;
|
||||||
import serp.util.Strings;
|
import serp.util.Strings;
|
||||||
|
|
||||||
@ -98,6 +99,7 @@ public class NativeJDBCSeq
|
|||||||
* @deprecated Use {@link #setSequence}. Retained for
|
* @deprecated Use {@link #setSequence}. Retained for
|
||||||
* backwards-compatibility for auto-configuration.
|
* backwards-compatibility for auto-configuration.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setSequenceName(String seqName) {
|
public void setSequenceName(String seqName) {
|
||||||
setSequence(seqName);
|
setSequence(seqName);
|
||||||
}
|
}
|
||||||
@ -147,6 +149,7 @@ public class NativeJDBCSeq
|
|||||||
/**
|
/**
|
||||||
* @deprecated Retained for backwards-compatibility for auto-configuration.
|
* @deprecated Retained for backwards-compatibility for auto-configuration.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setTableName(String table) {
|
public void setTableName(String table) {
|
||||||
_tableName = table;
|
_tableName = table;
|
||||||
}
|
}
|
||||||
@ -154,11 +157,13 @@ public class NativeJDBCSeq
|
|||||||
/**
|
/**
|
||||||
* @deprecated Retained for backwards-compatibility for auto-configuration.
|
* @deprecated Retained for backwards-compatibility for auto-configuration.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setFormat(String format) {
|
public void setFormat(String format) {
|
||||||
_format = format;
|
_format = format;
|
||||||
_subTable = true;
|
_subTable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addSchema(ClassMapping mapping, SchemaGroup group) {
|
public void addSchema(ClassMapping mapping, SchemaGroup group) {
|
||||||
// sequence already exists?
|
// sequence already exists?
|
||||||
if (group.isKnownSequence(_seqName))
|
if (group.isKnownSequence(_seqName))
|
||||||
@ -175,6 +180,7 @@ public class NativeJDBCSeq
|
|||||||
schema.importSequence(_seq);
|
schema.importSequence(_seq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public JDBCConfiguration getConfiguration() {
|
public JDBCConfiguration getConfiguration() {
|
||||||
return _conf;
|
return _conf;
|
||||||
}
|
}
|
||||||
@ -202,8 +208,11 @@ public class NativeJDBCSeq
|
|||||||
Object[] subs = (_subTable) ? new Object[]{ name, _tableName }
|
Object[] subs = (_subTable) ? new Object[]{ name, _tableName }
|
||||||
: new Object[]{ name };
|
: new Object[]{ name };
|
||||||
_select = MessageFormat.format(_format, subs);
|
_select = MessageFormat.format(_format, subs);
|
||||||
|
|
||||||
|
type = dict.nativeSequenceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected Object nextInternal(JDBCStore store, ClassMapping mapping)
|
protected Object nextInternal(JDBCStore store, ClassMapping mapping)
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
Connection conn = getConnection(store);
|
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.jdbc.schema.Unique;
|
||||||
import org.apache.openjpa.kernel.Filters;
|
import org.apache.openjpa.kernel.Filters;
|
||||||
import org.apache.openjpa.kernel.OpenJPAStateManager;
|
import org.apache.openjpa.kernel.OpenJPAStateManager;
|
||||||
|
import org.apache.openjpa.kernel.Seq;
|
||||||
import org.apache.openjpa.kernel.exps.Path;
|
import org.apache.openjpa.kernel.exps.Path;
|
||||||
import org.apache.openjpa.lib.conf.Configurable;
|
import org.apache.openjpa.lib.conf.Configurable;
|
||||||
import org.apache.openjpa.lib.conf.Configuration;
|
import org.apache.openjpa.lib.conf.Configuration;
|
||||||
@ -327,6 +328,8 @@ public class DBDictionary
|
|||||||
public String sequenceSQL = null;
|
public String sequenceSQL = null;
|
||||||
public String sequenceSchemaSQL = null;
|
public String sequenceSchemaSQL = null;
|
||||||
public String sequenceNameSQL = 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 JDBCConfiguration conf = null;
|
||||||
protected Log log = null;
|
protected Log log = null;
|
||||||
|
@ -270,7 +270,8 @@ public class SequenceMetaData
|
|||||||
J2DoPrivHelper.newInstanceAction(cls));
|
J2DoPrivHelper.newInstanceAction(cls));
|
||||||
Configurations.configureInstance(seq,
|
Configurations.configureInstance(seq,
|
||||||
_repos.getConfiguration(), props.toString());
|
_repos.getConfiguration(), props.toString());
|
||||||
seq.setType(_type);
|
if(_type != Seq.TYPE_DEFAULT)
|
||||||
|
seq.setType(_type);
|
||||||
} else if (_factory != null)
|
} else if (_factory != null)
|
||||||
seq = _factory.toSequence(cls, props.toString());
|
seq = _factory.toSequence(cls, props.toString());
|
||||||
else
|
else
|
||||||
@ -339,6 +340,7 @@ public class SequenceMetaData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return _name;
|
return _name;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user