public class NativeJDBCSeq extends AbstractJDBCSeq implements Configurable
JDBCSeq implementation that uses a database sequence
to generate numbers.
Supports allocation (caching). In order for allocation to work properly, the database sequence must be defined
with INCREMENT BY value equal to allocate * increment.JDBCSeq,
AbstractJDBCSeq| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ACTION_ADD |
static java.lang.String |
ACTION_DROP |
static java.lang.String |
ACTION_GET |
current, typeTYPE_CONTIGUOUS, TYPE_DEFAULT, TYPE_NONTRANSACTIONAL, TYPE_TRANSACTIONAL| Constructor and Description |
|---|
NativeJDBCSeq() |
| Modifier and Type | Method and Description |
|---|---|
void |
addSchema(ClassMapping mapping,
SchemaGroup group)
No-op.
|
protected void |
allocateInternal(int additional,
JDBCStore store,
ClassMapping mapping)
Allocate additional sequence values.
|
void |
dropSequence()
Drops the sequence in the DB.
|
void |
endConfiguration()
Invoked upon completion of bean property configuration for this object.
|
int |
getAllocate() |
JDBCConfiguration |
getConfiguration()
Return the
JDBCConfiguration for this sequence. |
int |
getIncrement() |
int |
getInitialValue() |
java.lang.String |
getSchema()
Deprecated.
|
DBIdentifier |
getSchemaIdentifier() |
java.lang.String |
getSequence()
The sequence name.
|
static void |
main(java.lang.String[] args)
Usage: java org.apache.openjpa.jdbc.schema.NativeJDBCSequence [option]*
-action/-a <add | drop | get>
Where the following options are recognized.
|
protected java.lang.Object |
nextInternal(JDBCStore store,
ClassMapping mapping)
Return the next sequence object.
|
void |
refreshSequence()
Creates the sequence in the DB.
|
static boolean |
run(JDBCConfiguration conf,
java.lang.String[] args,
Options opts)
Run the tool.
|
static boolean |
run(JDBCConfiguration conf,
java.lang.String[] args,
java.lang.String action)
Run the tool.
|
void |
setAllocate(int allocate) |
void |
setConfiguration(Configuration conf)
Invoked prior to setting bean properties.
|
void |
setIncrement(int increment) |
void |
setInitialValue(int initial) |
void |
setSchema(java.lang.String schema)
Deprecated.
|
void |
setSequence(java.lang.String seqName)
The sequence name.
|
void |
startConfiguration()
Invoked before bean property configuration is begun on this object.
|
allocate, close, closeConnection, current, currentInternal, getConnection, next, setType, suspendInJTApublic static final java.lang.String ACTION_DROP
public static final java.lang.String ACTION_ADD
public static final java.lang.String ACTION_GET
public java.lang.String getSequence()
OPENJPA_SEQUENCE.public void setSequence(java.lang.String seqName)
OPENJPA_SEQUENCE.public int getInitialValue()
Sequence.getInitialValue()public void setInitialValue(int initial)
Sequence.setInitialValue(int)public int getAllocate()
Sequence.getAllocate()public void setAllocate(int allocate)
Sequence.setAllocate(int)public int getIncrement()
Sequence.getIncrement()public void setIncrement(int increment)
Sequence.setIncrement(int)public void addSchema(ClassMapping mapping, SchemaGroup group)
AbstractJDBCSeqaddSchema in interface JDBCSeqaddSchema in class AbstractJDBCSeqpublic JDBCConfiguration getConfiguration()
AbstractJDBCSeqJDBCConfiguration for this sequence.getConfiguration in class AbstractJDBCSeqpublic void setConfiguration(Configuration conf)
ConfigurablesetConfiguration in interface Configurablepublic void startConfiguration()
ConfigurablestartConfiguration in interface Configurablepublic void endConfiguration()
ConfigurableendConfiguration in interface Configurableprotected java.lang.Object nextInternal(JDBCStore store, ClassMapping mapping) throws java.sql.SQLException
AbstractJDBCSeqnextInternal in class AbstractJDBCSeqjava.sql.SQLExceptionprotected void allocateInternal(int additional,
JDBCStore store,
ClassMapping mapping)
throws java.sql.SQLException
allocateInternal in class AbstractJDBCSeqadditional - ignored - the allocation size is fixed and determined by allocate and increment properties.store - used to obtain connectionmapping - ignoredjava.sql.SQLExceptionpublic void refreshSequence()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void dropSequence()
throws java.sql.SQLException
java.sql.SQLExceptionpublic static void main(java.lang.String[] args)
throws java.lang.Exception
JDBCConfiguration. Optional.JDBCConfiguration can be set by
using their names and supplying a value.java.lang.Exceptionpublic static boolean run(JDBCConfiguration conf, java.lang.String[] args, Options opts) throws java.lang.Exception
java.lang.Exceptionpublic static boolean run(JDBCConfiguration conf, java.lang.String[] args, java.lang.String action) throws java.lang.Exception
java.lang.Exceptionpublic void setSchema(java.lang.String schema)
public java.lang.String getSchema()
public DBIdentifier getSchemaIdentifier()
Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.