Package org.apache.openjpa.jdbc.kernel
Class ClassTableJDBCSeq
- java.lang.Object
-
- org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq
-
- org.apache.openjpa.jdbc.kernel.TableJDBCSeq
-
- org.apache.openjpa.jdbc.kernel.ClassTableJDBCSeq
-
- All Implemented Interfaces:
JDBCSeq
,Seq
,Configurable
,Closeable
public class ClassTableJDBCSeq extends TableJDBCSeq
Specialization of theTableJDBCSeq
that maintains a separate sequence count per-class. Table name defaults toOPENJPA_SEQUENCES_TABLE
.- Author:
- Abe White
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.openjpa.jdbc.kernel.TableJDBCSeq
TableJDBCSeq.AllocateSequenceRunnable, TableJDBCSeq.CurrentSequenceRunnable, TableJDBCSeq.Status
-
-
Field Summary
-
Fields inherited from class org.apache.openjpa.jdbc.kernel.TableJDBCSeq
ACTION_ADD, ACTION_DROP, ACTION_GET, ACTION_SET, DEFAULT_TABLE
-
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
Constructors Constructor Description ClassTableJDBCSeq()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected Column
addPrimaryKeyColumn(Table table)
Add the primary key column to the given table and return it.boolean
getIgnoreUnmapped()
Whether unmapped classes should be ignored as possible primary key values in the table.protected java.lang.Object
getPrimaryKey(ClassMapping mapping)
Return the primary key value for the sequence table for the given class.protected TableJDBCSeq.Status
getStatus(ClassMapping mapping)
Return the appropriate status object for the given class, or null if cannot handle the given class.boolean
getUseAliases()
Whether to use type alises for primary key values in place of class names.static void
main(java.lang.String[] args)
Usage: java org.apache.openjpa.jdbc.kernel.ClassTableJDBCSeq [option]* -action/-a <add | drop | get | set> [class name | .java file | .class file | .jdo file] [value] Where the following options are recognized.static boolean
run(JDBCConfiguration conf, java.lang.String[] args, java.lang.String action, MappingRepository repos, java.lang.ClassLoader loader)
Run the tool.static boolean
run(JDBCConfiguration conf, java.lang.String[] args, Options opts)
Run the tool.void
setIgnoreUnmapped(boolean ignore)
Whether unmapped classes should be ignored as possible primary key values in the table.void
setIgnoreVirtual(boolean ignore)
Deprecated.void
setUseAliases(boolean aliases)
Whether to use type alises for primary key values in place of class names.-
Methods inherited from class org.apache.openjpa.jdbc.kernel.TableJDBCSeq
addSchema, allocateInternal, currentInternal, dropTable, endConfiguration, executeQuery, executeUpdate, getAllocate, getConfiguration, getInitialValue, getPrimaryKeyColumn, getPrimaryKeyColumnIdentifier, getSequence, getSequence, getSequenceColumn, getTable, getUniqueColumns, getUniqueConstraintIdentifier, getUniqueConstraintName, nextInternal, prepareStatement, refreshTable, resolveTableIdentifier, resolveTableName, run, setAllocate, setConfiguration, setIncrement, setInitialValue, setPrimaryKeyColumn, setSequence, setSequenceColumn, setTable, setTableName, setUniqueColumns, setUniqueConstraintName, setUniqueConstraintName, startConfiguration
-
Methods inherited from class org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq
allocate, close, closeConnection, current, getConnection, getConnection, next, setType, suspendInJTA
-
-
-
-
Method Detail
-
getIgnoreUnmapped
public boolean getIgnoreUnmapped()
Whether unmapped classes should be ignored as possible primary key values in the table. Defaults to false.
-
setIgnoreUnmapped
public void setIgnoreUnmapped(boolean ignore)
Whether unmapped classes should be ignored as possible primary key values in the table. Defaults to false.
-
setIgnoreVirtual
@Deprecated public void setIgnoreVirtual(boolean ignore)
Deprecated.UsesetIgnoreUnmapped(boolean)
. Retained for backwards-compatibility for auto-configuration.
-
getUseAliases
public boolean getUseAliases()
Whether to use type alises for primary key values in place of class names. Defaults to false.
-
setUseAliases
public void setUseAliases(boolean aliases)
Whether to use type alises for primary key values in place of class names. Defaults to false.
-
getStatus
protected TableJDBCSeq.Status getStatus(ClassMapping mapping)
Description copied from class:TableJDBCSeq
Return the appropriate status object for the given class, or null if cannot handle the given class. The mapping may be null.- Overrides:
getStatus
in classTableJDBCSeq
-
addPrimaryKeyColumn
protected Column addPrimaryKeyColumn(Table table)
Description copied from class:TableJDBCSeq
Add the primary key column to the given table and return it.- Overrides:
addPrimaryKeyColumn
in classTableJDBCSeq
-
getPrimaryKey
protected java.lang.Object getPrimaryKey(ClassMapping mapping)
Description copied from class:TableJDBCSeq
Return the primary key value for the sequence table for the given class.- Overrides:
getPrimaryKey
in classTableJDBCSeq
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception
Usage: java org.apache.openjpa.jdbc.kernel.ClassTableJDBCSeq [option]* -action/-a <add | drop | get | set> [class name | .java file | .class file | .jdo file] [value] Where the following options are recognized.- -properties/-p <properties file or resource>: The
path or resource name of a OpenJPA properties file containing
information such as connection data as
outlined in
JDBCConfiguration
. Optional. - -<property name> <property value>: All bean
properties of the OpenJPA
JDBCConfiguration
can be set by using their names and supplying a value.
- add: Create the sequence table.
- drop: Drop the sequence table.
- get: Print the current sequence value for the given class.
- set: Set the sequence value for the given class.
- Throws:
java.lang.Exception
- -properties/-p <properties file or resource>: The
path or resource name of a OpenJPA properties file containing
information such as connection data as
outlined in
-
run
public static boolean run(JDBCConfiguration conf, java.lang.String[] args, Options opts) throws java.lang.Exception
Run the tool. Returns false if invalid options were given.- Throws:
java.lang.Exception
-
run
public static boolean run(JDBCConfiguration conf, java.lang.String[] args, java.lang.String action, MappingRepository repos, java.lang.ClassLoader loader) throws java.lang.Exception
Run the tool. Return false if an invalid option was given.- Throws:
java.lang.Exception
-
-