org.apache.openjpa.jdbc.kernel
Class NativeJDBCSeq

java.lang.Object
  extended by org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq
      extended by org.apache.openjpa.jdbc.kernel.NativeJDBCSeq
All Implemented Interfaces:
JDBCSeq, org.apache.openjpa.kernel.Seq, org.apache.openjpa.lib.conf.Configurable, org.apache.openjpa.lib.util.Closeable

public class NativeJDBCSeq
extends AbstractJDBCSeq
implements org.apache.openjpa.lib.conf.Configurable

JDBCSeq implementation that uses a database sequences to generate numbers.

See Also:
JDBCSeq, AbstractJDBCSeq

Field Summary
static java.lang.String ACTION_ADD
           
static java.lang.String ACTION_DROP
           
static java.lang.String ACTION_GET
           
 
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
NativeJDBCSeq()
           
 
Method Summary
 void addSchema(ClassMapping mapping, SchemaGroup group)
          No-op.
 void dropSequence()
          Drops the sequence in the DB.
 void endConfiguration()
           
 int getAllocate()
           
 JDBCConfiguration getConfiguration()
          Return the JDBCConfiguration for this sequence.
 int getIncrement()
           
 int getInitialValue()
           
 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, 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 allocate)
           
 void setConfiguration(org.apache.openjpa.lib.conf.Configuration conf)
           
 void setFormat(java.lang.String format)
          Deprecated. Retained for backwards-compatibility for auto-configuration.
 void setIncrement(int increment)
           
 void setInitialValue(int initial)
           
 void setSequence(java.lang.String seqName)
          The sequence name.
 void setSequenceName(java.lang.String seqName)
          Deprecated. Use setSequence(java.lang.String). Retained for backwards-compatibility for auto-configuration.
 void setTableName(java.lang.String table)
          Deprecated. Retained for backwards-compatibility for auto-configuration.
 void startConfiguration()
           
 
Methods inherited from class org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq
allocate, allocateInternal, close, closeConnection, current, currentInternal, getConnection, next, setType, suspendInJTA
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION_DROP

public static final java.lang.String ACTION_DROP
See Also:
Constant Field Values

ACTION_ADD

public static final java.lang.String ACTION_ADD
See Also:
Constant Field Values

ACTION_GET

public static final java.lang.String ACTION_GET
See Also:
Constant Field Values
Constructor Detail

NativeJDBCSeq

public NativeJDBCSeq()
Method Detail

getSequence

public java.lang.String getSequence()
The sequence name. Defaults to OPENJPA_SEQUENCE.


setSequence

public void setSequence(java.lang.String seqName)
The sequence name. Defaults to OPENJPA_SEQUENCE.


setSequenceName

public void setSequenceName(java.lang.String seqName)
Deprecated. Use setSequence(java.lang.String). Retained for backwards-compatibility for auto-configuration.


getInitialValue

public int getInitialValue()
See Also:
Sequence.getInitialValue()

setInitialValue

public void setInitialValue(int initial)
See Also:
Sequence.setInitialValue(int)

getAllocate

public int getAllocate()
See Also:
Sequence.getAllocate()

setAllocate

public void setAllocate(int allocate)
See Also:
Sequence.setAllocate(int)

getIncrement

public int getIncrement()
See Also:
Sequence.getIncrement()

setIncrement

public void setIncrement(int increment)
See Also:
Sequence.setIncrement(int)

setTableName

public void setTableName(java.lang.String table)
Deprecated. Retained for backwards-compatibility for auto-configuration.


setFormat

public void setFormat(java.lang.String format)
Deprecated. Retained for backwards-compatibility for auto-configuration.


addSchema

public void addSchema(ClassMapping mapping,
                      SchemaGroup group)
Description copied from class: AbstractJDBCSeq
No-op.

Specified by:
addSchema in interface JDBCSeq
Overrides:
addSchema in class AbstractJDBCSeq

getConfiguration

public JDBCConfiguration getConfiguration()
Description copied from class: AbstractJDBCSeq
Return the JDBCConfiguration for this sequence.

Specified by:
getConfiguration in class AbstractJDBCSeq

setConfiguration

public void setConfiguration(org.apache.openjpa.lib.conf.Configuration conf)
Specified by:
setConfiguration in interface org.apache.openjpa.lib.conf.Configurable

startConfiguration

public void startConfiguration()
Specified by:
startConfiguration in interface org.apache.openjpa.lib.conf.Configurable

endConfiguration

public void endConfiguration()
Specified by:
endConfiguration in interface org.apache.openjpa.lib.conf.Configurable

nextInternal

protected java.lang.Object nextInternal(JDBCStore store,
                                        ClassMapping mapping)
                                 throws java.sql.SQLException
Description copied from class: AbstractJDBCSeq
Return the next sequence object.

Specified by:
nextInternal in class AbstractJDBCSeq
Throws:
java.sql.SQLException

refreshSequence

public void refreshSequence()
                     throws java.sql.SQLException
Creates the sequence in the DB.

Throws:
java.sql.SQLException

dropSequence

public void dropSequence()
                  throws java.sql.SQLException
Drops the sequence in the DB.

Throws:
java.sql.SQLException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Usage: java org.apache.openjpa.jdbc.schema.NativeJDBCSequence [option]* -action/-a <add | drop | get> Where the following options are recognized. The various actions are as follows.

Throws:
java.lang.Exception

run

public static boolean run(JDBCConfiguration conf,
                          java.lang.String[] args,
                          org.apache.openjpa.lib.util.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)
                   throws java.lang.Exception
Run the tool. Return false if an invalid option was given.

Throws:
java.lang.Exception