|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.openjpa.jdbc.kernel.AbstractJDBCSeq
org.apache.openjpa.jdbc.kernel.TableJDBCSeq
public class TableJDBCSeq
JDBCSeq
implementation that uses a database table
for sequence number generation. This base implementation uses a single
row for a global sequence number.
Nested Class Summary | |
---|---|
protected static class |
TableJDBCSeq.Status
Helper struct to hold status information. |
Field Summary | |
---|---|
static java.lang.String |
ACTION_ADD
|
static java.lang.String |
ACTION_DROP
|
static java.lang.String |
ACTION_GET
|
static java.lang.String |
ACTION_SET
|
Fields inherited from class org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq |
---|
current, type |
Fields inherited from interface org.apache.openjpa.kernel.Seq |
---|
TYPE_CONTIGUOUS, TYPE_DEFAULT, TYPE_NONTRANSACTIONAL, TYPE_TRANSACTIONAL |
Constructor Summary | |
---|---|
TableJDBCSeq()
|
Method Summary | |
---|---|
protected Column |
addPrimaryKeyColumn(Table table)
Add the primary key column to the given table and return it. |
void |
addSchema(ClassMapping mapping,
SchemaGroup group)
No-op. |
protected void |
allocateInternal(int count,
JDBCStore store,
ClassMapping mapping)
Allocate additional sequence values. |
protected java.lang.Object |
currentInternal(JDBCStore store,
ClassMapping mapping)
Return the current sequence object. |
void |
dropTable()
Drops the sequence table in the DB. |
void |
endConfiguration()
|
int |
getAllocate()
Return the number of sequences to allocate for each update of the sequence table. |
JDBCConfiguration |
getConfiguration()
|
protected java.lang.Object |
getPrimaryKey(ClassMapping mapping)
Return the primary key value for the given class. |
java.lang.String |
getPrimaryKeyColumn()
The name of the table's primary key column. |
protected long |
getSequence(ClassMapping mapping,
java.sql.Connection conn)
Return the current sequence value, or -1 if unattainable. |
java.lang.String |
getSequenceColumn()
The name of the column that holds the sequence value. |
protected TableJDBCSeq.Status |
getStatus(ClassMapping mapping)
Return the appropriate status object for the given class, or null if cannot handle the given class. |
java.lang.String |
getTable()
The sequence table name. |
static void |
main(java.lang.String[] args)
Usage: java org.apache.openjpa.jdbc.schema.TableJDBCSequence [option]* -action/-a <add | drop | get | set> [value] Where the following options are recognized. |
protected java.lang.Object |
nextInternal(JDBCStore store,
ClassMapping mapping)
Return the next sequence object. |
void |
refreshTable()
Creates the sequence table in the DB. |
static boolean |
run(JDBCConfiguration conf,
java.lang.String[] args,
org.apache.openjpa.lib.util.Options opts)
Run the tool. |
static boolean |
run(JDBCConfiguration conf,
java.lang.String[] args,
java.lang.String action)
Run the tool. |
void |
setAllocate(int alloc)
Return the number of sequences to allocate for each update of the sequence table. |
void |
setConfiguration(org.apache.openjpa.lib.conf.Configuration conf)
|
void |
setIncrement(int inc)
Deprecated. Use setAllocate(int) . Retained for backwards
compatibility of auto-configuration. |
void |
setPrimaryKeyColumn(java.lang.String primaryKeyColumn)
The name of the table's primary key column. |
protected boolean |
setSequence(ClassMapping mapping,
TableJDBCSeq.Status stat,
int inc,
boolean updateStatSeq,
java.sql.Connection conn)
Grabs the next handful of sequence numbers. |
void |
setSequenceColumn(java.lang.String sequenceColumn)
The name of the column that holds the sequence value. |
void |
setTable(java.lang.String name)
The sequence table name. |
void |
setTableName(java.lang.String name)
Deprecated. Use setTable(java.lang.String) . Retained for
backwards-compatibility with auto-configuration. |
void |
startConfiguration()
|
Methods inherited from class org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq |
---|
allocate, close, closeConnection, current, getConnection, next, setType |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ACTION_DROP
public static final java.lang.String ACTION_ADD
public static final java.lang.String ACTION_GET
public static final java.lang.String ACTION_SET
Constructor Detail |
---|
public TableJDBCSeq()
Method Detail |
---|
public java.lang.String getTable()
OPENJPA_SEQUENCE_TABLE
.
By default, the table will be placed in the first schema listed in your
openjpa.jdbc.Schemas
property, or in the default schema if
the property is not given. If you specify a table name in the form
<schema>.<table>
, then the given schema
will be used.
public void setTable(java.lang.String name)
OPENJPA_SEQUENCE_TABLE
.
By default, the table will be placed in the first schema listed in your
openjpa.jdbc.Schemas
property, or in the default schema if
the property is not given. If you specify a table name in the form
<schema>.<table>
, then the given schema
will be used.
public void setTableName(java.lang.String name)
setTable(java.lang.String)
. Retained for
backwards-compatibility with auto-configuration.
public java.lang.String getSequenceColumn()
SEQUENCE_VALUE
.
public void setSequenceColumn(java.lang.String sequenceColumn)
SEQUENCE_VALUE
.
public java.lang.String getPrimaryKeyColumn()
ID
.
public void setPrimaryKeyColumn(java.lang.String primaryKeyColumn)
ID
.
public int getAllocate()
public void setAllocate(int alloc)
public void setIncrement(int inc)
setAllocate(int)
. Retained for backwards
compatibility of auto-configuration.
public JDBCConfiguration getConfiguration()
public void setConfiguration(org.apache.openjpa.lib.conf.Configuration conf)
setConfiguration
in interface org.apache.openjpa.lib.conf.Configurable
public void startConfiguration()
startConfiguration
in interface org.apache.openjpa.lib.conf.Configurable
public void endConfiguration()
endConfiguration
in interface org.apache.openjpa.lib.conf.Configurable
public void addSchema(ClassMapping mapping, SchemaGroup group)
AbstractJDBCSeq
addSchema
in interface JDBCSeq
addSchema
in class AbstractJDBCSeq
protected java.lang.Object nextInternal(JDBCStore store, ClassMapping mapping) throws java.lang.Exception
AbstractJDBCSeq
nextInternal
in class AbstractJDBCSeq
java.lang.Exception
protected java.lang.Object currentInternal(JDBCStore store, ClassMapping mapping) throws java.lang.Exception
AbstractJDBCSeq
currentInternal
in class AbstractJDBCSeq
java.lang.Exception
protected void allocateInternal(int count, JDBCStore store, ClassMapping mapping) throws java.sql.SQLException
AbstractJDBCSeq
allocateInternal
in class AbstractJDBCSeq
java.sql.SQLException
protected TableJDBCSeq.Status getStatus(ClassMapping mapping)
protected Column addPrimaryKeyColumn(Table table)
protected java.lang.Object getPrimaryKey(ClassMapping mapping)
protected long getSequence(ClassMapping mapping, java.sql.Connection conn) throws java.sql.SQLException
java.sql.SQLException
protected boolean setSequence(ClassMapping mapping, TableJDBCSeq.Status stat, int inc, boolean updateStatSeq, java.sql.Connection conn) throws java.sql.SQLException
java.sql.SQLException
public void refreshTable() throws java.sql.SQLException
java.sql.SQLException
public void dropTable() throws java.sql.SQLException
java.sql.SQLException
public 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. For example:
-licenseKey adslfja83r3lkadf
java.lang.Exception
public static boolean run(JDBCConfiguration conf, java.lang.String[] args, org.apache.openjpa.lib.util.Options opts) throws java.lang.Exception
java.lang.Exception
public static boolean run(JDBCConfiguration conf, java.lang.String[] args, java.lang.String action) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |