A stateless SDOResultSet can be detached from an AppObject (or SDOAppObject) and re-attached to a specified (not necessarily the same) AppObject. By detaching the ResultSet and releasing the AppObject (disconnecting the application server), the Open Client can use and manipulate the ResultSet without holding any resources on the application server.

Most of the SDOResultSet methods available on a normal stateless SDOResultSet are available on a detached SDOResultSet. The exceptions are these methods, which require an application server connection:

Thus, before calling a method that requires an application server connection, you must attach the SDOResultSet to the same or a different AppObject with a connection to the application server. Here are the methods that provide this functionality.

The following method detaches from the AppObject that created the ResultSet:

Syntax

void detachFromAppObj() [Extension]

The following method attaches to the AppObject, SubAppObject, or SDOAppObject specified by ProxyObject:

Syntax

void attachToAppObj(SDOFactory ProxyObject) [Extension]
Note: ProxyGen-generated AppObjects and SubAppObjects, as well as the SDOAppObject proxy, all implement the SDOFactory interface.

The following method returns true if the SDOResultSet is attached to an AppObject; otherwise, it returns false:

Syntax

boolean isAttached() [Extension]

The following is a typical scenario for using the detaching and attaching functionality:

  1. The SDOResultSet is created. Because the scrolling mode is PREFETCH, all the rows are read and returned to the client.
  2. The SDOResultSet is detached from the AppObject.
  3. The AppObject is released (the application server connection closed).
  4. The client accesses data and possibly calls startBatch() and updates some data.
  5. The SDOResultSet is attached to another open application server connection.
  6. The client calls sendBatch() to apply the modifications.

The SDOResultSet interface extends the java.io.Serializable interface. As a result, a detached SDOResultSet can be stored and retrieved from disk using the standard Java serialization mechanism. It also can be passed by value and returned from methods using remote method invocation (RMI). After being restored from disk or being received through an RMI call, the SDOResultSet can be re-attached to an AppObject using the attachToAppObj() method.