| 
 | ||||||||||
| 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  class | TableJDBCSeq.AllocateSequenceRunnableAllocateSequenceRunnable is a runnable wrapper that will inserts the initial sequence value into the database. | 
| protected  class | TableJDBCSeq.CurrentSequenceRunnableCurentSequenceRunnable is a runnable wrapper which obtains the current sequence value from the database. | 
| protected static class | TableJDBCSeq.StatusHelper 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() | 
| protected  java.sql.ResultSet | executeQuery(JDBCConfiguration conf,
             java.sql.Connection conn,
             java.sql.PreparedStatement stmnt,
             SQLBuffer buf)This method is to provide override for non-JDBC or JDBC-like implementation of executing query. | 
| protected  int | executeUpdate(JDBCConfiguration conf,
              java.sql.Connection conn,
              java.sql.PreparedStatement stmnt,
              SQLBuffer buf,
              int opcode)This method is to provide override for non-JDBC or JDBC-like implementation of executing update. | 
|  int | getAllocate()Return the number of sequences to allocate for each update of the sequence table. | 
|  JDBCConfiguration | getConfiguration()Return the JDBCConfigurationfor this sequence. | 
|  int | getInitialValue()Return the number as the initial number for the GeneratedValue.TABLE strategy to start with. | 
| 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)Get the current sequence value. | 
| protected  long | getSequence(java.sql.ResultSet rs,
            DBDictionary dict)This method is to provide override for non-JDBC or JDBC-like implementation of getting sequence from the result set. | 
|  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. | 
|  java.lang.String | getUniqueColumns() | 
| 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. | 
| protected  java.sql.PreparedStatement | prepareStatement(java.sql.Connection conn,
                 SQLBuffer buf)This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement. | 
|  void | refreshTable()Creates the sequence table in the DB. | 
|  java.lang.String | resolveTableName(ClassMapping mapping,
                 Table table)Resolve a fully qualified table name | 
| static boolean | run(JDBCConfiguration conf,
    java.lang.String[] args,
    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(Configuration conf) | 
|  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(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 | setUniqueColumns(java.lang.String columnNames)Sets the names of the columns on which a unique constraint is set. | 
|  void | startConfiguration() | 
| 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 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 int getInitialValue()
public void setInitialValue(int intValue)
intValue. - The initial numberpublic void setUniqueColumns(java.lang.String columnNames)
columnsNames - are passed as a single String concatenated with
 a '|' character. This method parses it back to array of Strings.public java.lang.String getUniqueColumns()
public void setIncrement(int inc)
setAllocate(int). Retained for backwards
 compatibility of auto-configuration.
public JDBCConfiguration getConfiguration()
AbstractJDBCSeqJDBCConfiguration for this sequence.
getConfiguration in class AbstractJDBCSeqpublic void setConfiguration(Configuration conf)
setConfiguration in interface Configurablepublic void startConfiguration()
startConfiguration in interface Configurablepublic void endConfiguration()
endConfiguration in interface Configurable
public void addSchema(ClassMapping mapping,
                      SchemaGroup group)
AbstractJDBCSeq
addSchema in interface JDBCSeqaddSchema in class AbstractJDBCSeq
protected java.lang.Object nextInternal(JDBCStore store,
                                        ClassMapping mapping)
                                 throws java.lang.Exception
AbstractJDBCSeq
nextInternal in class AbstractJDBCSeqjava.lang.Exception
protected java.lang.Object currentInternal(JDBCStore store,
                                           ClassMapping mapping)
                                    throws java.lang.Exception
AbstractJDBCSeq
currentInternal in class AbstractJDBCSeqjava.lang.Exception
protected void allocateInternal(int count,
                                JDBCStore store,
                                ClassMapping mapping)
                         throws java.sql.SQLException
AbstractJDBCSeq
allocateInternal in class AbstractJDBCSeqjava.sql.SQLExceptionprotected 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
mapping - ClassMapping of the entity whose sequence value will be
            obtained.conn - Connection used issue SQL statements.
SEQUENCE_NOT_FOUND
         if the sequence could not be found.
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 java.lang.String resolveTableName(ClassMapping mapping,
                                         Table table)
class - mapping to get the schema name
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,
                          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
protected java.sql.PreparedStatement prepareStatement(java.sql.Connection conn,
                                                      SQLBuffer buf)
                                               throws java.sql.SQLException
java.sql.SQLException
protected int executeUpdate(JDBCConfiguration conf,
                            java.sql.Connection conn,
                            java.sql.PreparedStatement stmnt,
                            SQLBuffer buf,
                            int opcode)
                     throws java.sql.SQLException
java.sql.SQLException
protected java.sql.ResultSet executeQuery(JDBCConfiguration conf,
                                          java.sql.Connection conn,
                                          java.sql.PreparedStatement stmnt,
                                          SQLBuffer buf)
                                   throws java.sql.SQLException
java.sql.SQLException
protected long getSequence(java.sql.ResultSet rs,
                           DBDictionary dict)
                    throws java.sql.SQLException
java.sql.SQLException| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||