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, Seq, Configurable, Closeable

public class NativeJDBCSeq
extends AbstractJDBCSeq
implements Configurable

JDBCSeq implementation that uses a database sequences to generate numbers.

See Also:
JDBCSeq, AbstractJDBCSeq

Field Summary
static String ACTION_ADD
           
static String ACTION_DROP
           
static 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()
          Invoked upon completion of bean property configuration for this object.
 int getAllocate()
           
 JDBCConfiguration getConfiguration()
          Return the JDBCConfiguration for this sequence.
 int getIncrement()
           
 int getInitialValue()
           
 String getSequence()
          The sequence name.
static void main(String[] args)
          Usage: java org.apache.openjpa.jdbc.schema.NativeJDBCSequence [option]* -action/-a <add | drop | get> Where the following options are recognized.
protected  Object nextInternal(JDBCStore store, ClassMapping mapping)
          Return the next sequence object.
 void refreshSequence()
          Creates the sequence 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 allocate)
           
 void setConfiguration(Configuration conf)
          Invoked prior to setting bean properties.
 void setFormat(String format)
          Deprecated. Retained for backwards-compatibility for auto-configuration.
 void setIncrement(int increment)
           
 void setInitialValue(int initial)
           
 void setSequence(String seqName)
          The sequence name.
 void setSequenceName(String seqName)
          Deprecated. Use setSequence(java.lang.String). Retained for backwards-compatibility for auto-configuration.
 void setTableName(String table)
          Deprecated. Retained for backwards-compatibility for 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, 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 String ACTION_DROP
See Also:
Constant Field Values

ACTION_ADD

public static final String ACTION_ADD
See Also:
Constant Field Values

ACTION_GET

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

NativeJDBCSeq

public NativeJDBCSeq()
Method Detail

getSequence

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


setSequence

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


setSequenceName

public void setSequenceName(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(String table)
Deprecated. Retained for backwards-compatibility for auto-configuration.


setFormat

public void setFormat(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(Configuration conf)
Description copied from interface: Configurable
Invoked prior to setting bean properties.

Specified by:
setConfiguration in interface Configurable

startConfiguration

public void startConfiguration()
Description copied from interface: Configurable
Invoked before bean property configuration is begun on this object.

Specified by:
startConfiguration in interface Configurable

endConfiguration

public void endConfiguration()
Description copied from interface: Configurable
Invoked upon completion of bean property configuration for this object.

Specified by:
endConfiguration in interface Configurable

nextInternal

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

Specified by:
nextInternal in class AbstractJDBCSeq
Throws:
SQLException

refreshSequence

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

Throws:
SQLException

dropSequence

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

Throws:
SQLException

main

public static void main(String[] args)
                 throws 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:
Exception

run

public static boolean run(JDBCConfiguration conf,
                          String[] args,
                          Options opts)
                   throws Exception
Run the tool. Returns false if invalid options were given.

Throws:
Exception

run

public static boolean run(JDBCConfiguration conf,
                          String[] args,
                          String action)
                   throws Exception
Run the tool. Return false if an invalid option was given.

Throws:
Exception


Copyright © 2006-2007 Apache Software Foundation. All Rights Reserved.