|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.jbo.server.SequenceImpl
public class SequenceImpl
An encapsulation of a database sequence. This class provides a Java wrapper for a database sequence and may be used whenever it is necessary to query sequence values from a database sequence. See the discussion below for more information on using this class to query database sequences instead of instantiating a dynamic View Object.
String sqlStr = "SELECT CRM_INT_PROCESSES_SEQ.NEXTVAL FROM DUAL "; ViewObject View0 = appMod.createViewObjectFromQueryStmt("SeqView", sqlStr); Row idRow = View0.first();
When View0.first() (or last(), for that matter) is executed, the query is executed twice and sequence numbers are lost. Setting the View Object to setForwardOnly also has no effect.
This problem is caused by a JDBC bug that forces "prefetch" to be greater than or equal to 1. That is, when you execute the query for the View Object, it fetches at least one row before you call next(). This is why the sequence number increases by two.
Instead of instantiating a View Object, explicitly create a new sequence:
import oracle.jbo.server.SequenceImpl; . . SequenceImpl s = new SequenceImpl(sequenceName, thisTransaction); Number sVal = s.getSequenceNumber(); . . setYourSequenceAttribute(sVal); .
ViewObject
,
DBTransaction
,
ApplicationModule
Field Summary | |
---|---|
static java.lang.Class |
CLASS_INSTANCE
|
Constructor Summary | |
---|---|
SequenceImpl(java.lang.Long value)
|
|
SequenceImpl(java.lang.String seqName,
ApplicationModule am)
Constructor. |
|
SequenceImpl(java.lang.String seqName,
Connection conn,
ConnectionDetails details)
|
|
SequenceImpl(java.lang.String seqName,
DBTransaction trans)
Constructor. |
Method Summary | |
---|---|
static java.lang.String |
determineSequenceName(java.lang.String applicationName,
java.lang.String tableName)
Internal use only. |
boolean |
equals(java.lang.Object other)
Test if the specified value is equal to this SequenceImpl object. |
java.lang.Object |
getData()
Internal: Applications should not use this method. Returns a sequence value. |
Number |
getSequenceNumber()
Returns a sequence value. |
int |
hashCode()
Computes a hash code for this SequenceImpl object. |
void |
setContext(DomainOwnerInterface owner,
Transaction trans,
java.lang.Object ctx)
Internal: Applications should not use this method. |
java.lang.String |
toString()
For testing purposes only: Returns a string representation of the generated sequence value. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.Class CLASS_INSTANCE
Constructor Detail |
---|
public SequenceImpl(java.lang.String seqName, ApplicationModule am)
seqName
- The name of the database sequence that will be used to generate sequence values.am
- The application module instance that will provide the JDBC connection for the sequence requests.public SequenceImpl(java.lang.String seqName, DBTransaction trans)
seqName
- The name of the database sequence that will be used to generate sequence values.trans
- The Transaction instance that will provide the JDBC connection for the sequence requests.public SequenceImpl(java.lang.String seqName, Connection conn, ConnectionDetails details)
public SequenceImpl(java.lang.Long value)
Method Detail |
---|
public void setContext(DomainOwnerInterface owner, Transaction trans, java.lang.Object ctx)
setContext
in interface DomainInterface
public java.lang.Object getData()
This method will increment the encapsulated database sequence the first time that it is invoked. Subsequent calls will return the same value.
getData
in interface DomainInterface
public Number getSequenceNumber()
This method will increment the encapsulated database sequence the first time that it is invoked. Subsequent calls will return the same value.
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object other)
this
SequenceImpl object.
equals
in class java.lang.Object
other
- The object to which the SequenceImpl should be compared.
this
SequenceImpl.public int hashCode()
this
SequenceImpl object.
hashCode
in class java.lang.Object
this
SequenceImpl object.public static java.lang.String determineSequenceName(java.lang.String applicationName, java.lang.String tableName)
schemaName
- applicationName
- tableName
-
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |