|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 String |
ACTION_ADD
|
static String |
ACTION_DROP
|
static String |
ACTION_GET
|
static 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 Object |
currentInternal(JDBCStore store,
ClassMapping mapping)
Return the current sequence object. |
void |
dropTable()
Drops the sequence table in the DB. |
void |
endConfiguration()
Invoked upon completion of bean property configuration for this object. |
int |
getAllocate()
Return the number of sequences to allocate for each update of the sequence table. |
JDBCConfiguration |
getConfiguration()
Return the JDBCConfiguration for this sequence. |
int |
getInitialValue()
Return the number as the initial number for the GeneratedValue.TABLE strategy to start with. |
protected Object |
getPrimaryKey(ClassMapping mapping)
Return the primary key value for the given class. |
String |
getPrimaryKeyColumn()
The name of the table's primary key column. |
protected long |
getSequence(ClassMapping mapping,
Connection conn)
Return the current sequence value, or -1 if unattainable. |
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. |
String |
getTable()
The sequence table name. |
static void |
main(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 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,
String[] args,
Options opts)
Run the tool. |
static boolean |
run(JDBCConfiguration conf,
String[] args,
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(Configuration conf)
Invoked prior to setting bean properties. |
void |
setIncrement(int inc)
Deprecated. Use setAllocate(int) . Retained for backwards
compatibility of auto-configuration. |
void |
setInitialValue(int intValue)
Set the initial number in the table for the GeneratedValue.TABLE strategy to use as initial number. |
void |
setPrimaryKeyColumn(String primaryKeyColumn)
The name of the table's primary key column. |
protected boolean |
setSequence(ClassMapping mapping,
TableJDBCSeq.Status stat,
int inc,
boolean updateStatSeq,
Connection conn)
Grabs the next handful of sequence numbers. |
void |
setSequenceColumn(String sequenceColumn)
The name of the column that holds the sequence value. |
void |
setTable(String name)
The sequence table name. |
void |
setTableName(String name)
Deprecated. Use setTable(java.lang.String) . Retained for
backwards-compatibility with auto-configuration. |
void |
startConfiguration()
Invoked before bean property configuration is begun on this object. |
Methods inherited from class org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq |
---|
allocate, close, closeConnection, current, getConnection, next, setType, suspendInJTA |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ACTION_DROP
public static final String ACTION_ADD
public static final String ACTION_GET
public static final String ACTION_SET
Constructor Detail |
---|
public TableJDBCSeq()
Method Detail |
---|
public 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(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(String name)
setTable(java.lang.String)
. Retained for
backwards-compatibility with auto-configuration.
public String getSequenceColumn()
SEQUENCE_VALUE
.
public void setSequenceColumn(String sequenceColumn)
SEQUENCE_VALUE
.
public String getPrimaryKeyColumn()
ID
.
public void setPrimaryKeyColumn(String primaryKeyColumn)
ID
.
public int getAllocate()
public void setAllocate(int alloc)
public int getInitialValue()
public void setInitialValue(int intValue)
intValue.
- The initial numberpublic void setIncrement(int inc)
setAllocate(int)
. Retained for backwards
compatibility of auto-configuration.
public JDBCConfiguration getConfiguration()
AbstractJDBCSeq
JDBCConfiguration
for this sequence.
getConfiguration
in class AbstractJDBCSeq
public void setConfiguration(Configuration conf)
Configurable
setConfiguration
in interface Configurable
public void startConfiguration()
Configurable
startConfiguration
in interface Configurable
public void endConfiguration()
Configurable
endConfiguration
in interface Configurable
public void addSchema(ClassMapping mapping, SchemaGroup group)
AbstractJDBCSeq
addSchema
in interface JDBCSeq
addSchema
in class AbstractJDBCSeq
protected Object nextInternal(JDBCStore store, ClassMapping mapping) throws Exception
AbstractJDBCSeq
nextInternal
in class AbstractJDBCSeq
Exception
protected Object currentInternal(JDBCStore store, ClassMapping mapping) throws Exception
AbstractJDBCSeq
currentInternal
in class AbstractJDBCSeq
Exception
protected void allocateInternal(int count, JDBCStore store, ClassMapping mapping) throws SQLException
AbstractJDBCSeq
allocateInternal
in class AbstractJDBCSeq
SQLException
protected TableJDBCSeq.Status getStatus(ClassMapping mapping)
protected Column addPrimaryKeyColumn(Table table)
protected Object getPrimaryKey(ClassMapping mapping)
protected long getSequence(ClassMapping mapping, Connection conn) throws SQLException
SQLException
protected boolean setSequence(ClassMapping mapping, TableJDBCSeq.Status stat, int inc, boolean updateStatSeq, Connection conn) throws SQLException
SQLException
public void refreshTable() throws SQLException
SQLException
public void dropTable() throws SQLException
SQLException
public static void main(String[] args) throws Exception
JDBCConfiguration
. Optional.JDBCConfiguration
can be set by
using their names and supplying a value. For example:
-licenseKey adslfja83r3lkadf
Exception
public static boolean run(JDBCConfiguration conf, String[] args, Options opts) throws Exception
Exception
public static boolean run(JDBCConfiguration conf, String[] args, String action) throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |