org.apache.openjpa.jdbc.kernel
public abstract class AbstractJDBCSeq extends java.lang.Object implements JDBCSeq
Modifier and Type | Field and Description |
---|---|
protected java.lang.Object |
current |
protected int |
type |
TYPE_CONTIGUOUS, TYPE_DEFAULT, TYPE_NONTRANSACTIONAL, TYPE_TRANSACTIONAL
Constructor and Description |
---|
AbstractJDBCSeq() |
Modifier and Type | Method and Description |
---|---|
void |
addSchema(ClassMapping mapping,
SchemaGroup group)
No-op.
|
void |
allocate(int additional,
StoreContext ctx,
ClassMetaData meta)
Allocate additional values efficiently.
|
protected void |
allocateInternal(int additional,
JDBCStore store,
ClassMapping mapping)
Allocate additional sequence values.
|
void |
close()
No-op.
|
protected void |
closeConnection(java.sql.Connection conn)
Close the current connection.
|
java.lang.Object |
current(StoreContext ctx,
ClassMetaData meta)
Return the current value of the sequence, or null if not available.
|
protected java.lang.Object |
currentInternal(JDBCStore store,
ClassMapping mapping)
Return the current sequence object.
|
abstract JDBCConfiguration |
getConfiguration()
Return the
JDBCConfiguration for this sequence. |
protected java.sql.Connection |
getConnection(JDBCStore store)
Return the connection to use based on the type of sequence.
|
java.lang.Object |
next(StoreContext ctx,
ClassMetaData meta)
Return the next value in the sequence.
|
protected abstract java.lang.Object |
nextInternal(JDBCStore store,
ClassMapping mapping)
Return the next sequence object.
|
void |
setType(int type)
Records the sequence type.
|
protected boolean |
suspendInJTA()
Detect whether or not OpenJPA should suspend the transaction in
a managed environment.
|
public void setType(int type)
public java.lang.Object next(StoreContext ctx, ClassMetaData meta)
Seq
public java.lang.Object current(StoreContext ctx, ClassMetaData meta)
Seq
public void allocate(int additional, StoreContext ctx, ClassMetaData meta)
Seq
public void addSchema(ClassMapping mapping, SchemaGroup group)
public void close()
protected abstract java.lang.Object nextInternal(JDBCStore store, ClassMapping mapping) throws java.lang.Exception
java.lang.Exception
public abstract JDBCConfiguration getConfiguration()
JDBCConfiguration
for this sequence.protected java.lang.Object currentInternal(JDBCStore store, ClassMapping mapping) throws java.lang.Exception
java.lang.Exception
protected void allocateInternal(int additional, JDBCStore store, ClassMapping mapping) throws java.lang.Exception
java.lang.Exception
protected java.sql.Connection getConnection(JDBCStore store) throws java.sql.SQLException
Return the connection to use based on the type of sequence. This connection will automatically be closed; do not close it.
TYPE_TRANSACTIONAL
or
TYPE_CONTIGUOUS
the connection from the StoreManager
will be returned.
Otherwise a new connection will be obtained using DataSource2 from the current configuration. In this case autocommit is set to false prior to returning the connection.
java.sql.SQLException
protected void closeConnection(java.sql.Connection conn)
TYPE_TRANSACTIONAL
or TYPE_CONTIGUOUS
we will decrement the ref count. Otherwise the connection will be
committed and then closed.protected boolean suspendInJTA()