public interface WebRowSet extends CachedRowSet
WebRowSetのすべての実装が実装しなければならない標準インタフェースです。
WebRowSetImplは、必要に応じて拡張可能な標準リファレンス実装を提供します。
標準WebRowSet XMLスキーマ定義は、次のURIで確認できます。
このスキーマ定義は、XMLでRowSetを記述するときに必要な標準XMLドキュメント形式について記述したものです。相互運用性を得るためには、WebRowSetインタフェースのすべての標準実装で、このスキーマ定義を使用する必要があります。 WebRowSetスキーマは固有のSQL/XMLスキーマ注釈を使用するので、プラットフォーム間の相互運用性がさらに向上します。 なお、このスキーマ定義は、ISO内で現在開発中です。 SQL/XML定義は、次のURIで確認できます。
このスキーマ定義は、RowSetオブジェクトの内部データを次の3つの領域から記述します。
RowSetプロパティに加えて、標準同期プロバイダのプロパティを記述する。
WebRowSetオブジェクトの管理下にある表構造に関連付けられたメタデータについて記述する。 記述されるメタデータは、配下のjava.sql.ResultSetインタフェース内でアクセス可能なメタデータと密接に連携している。
WebRowSetオブジェクトを生成または同期してからのデータの状態)と現在のデータについて記述する。 元のデータと現在のデータのデルタを追跡することにより、WebRowSetを元のデータ・ソースと同期させることができる。
WebRowSet実装で、XMLスキーマを使用して、更新、挿入、または削除操作を記述し、XMLでのWebRowSetオブジェクトの状態を記述する方法について具体的に説明します。
WebRowSetオブジェクトのXMLでの出力WebRowSetオブジェクトが、データ・ソースから、2列×5行の単純な表形式で生成されます。 WebRowSetオブジェクトに5行あるため、それらをXMLで記述できます。 RowSetインタフェースに定義された様々な標準JavaBeansプロパティと、CachedRowSet™インタフェースに定義された標準プロパティとを記述するメタデータにより、WebRowSetプロパティを記述する主な詳細情報が提供されます。 標準writeXmlメソッドを使ってWebRowSetオブジェクトをXMLで出力した場合、内部プロパティは次のように記述されます。
<properties>
<command>select co1, col2 from test_table</command>
<concurrency>1</concurrency>
<datasource/>
<escape-processing>true</escape-processing>
<fetch-direction>0</fetch-direction>
<fetch-size>0</fetch-size>
<isolation-level>1</isolation-level>
<key-columns/>
<map/>
<max-field-size>0</max-field-size>
<max-rows>0</max-rows>
<query-timeout>0</query-timeout>
<read-only>false</read-only>
<rowset-type>TRANSACTION_READ_UNCOMMITED</rowset-type>
<show-deleted>false</show-deleted>
<table-name/>
<url>jdbc:thin:oracle</url>
<sync-provider>
<sync-provider-name>.com.rowset.provider.RIOptimisticProvider</sync-provider-name>
<sync-provider-vendor>Oracle Corporation</sync-provider-vendor>
<sync-provider-version>1.0</sync-provider-name>
<sync-provider-grade>LOW</sync-provider-grade>
<data-source-lock>NONE</data-source-lock>
</sync-provider>
</properties>
WebRowSetの構成を記述するメタデータは、XMLで記述されます(詳細は下記)。 両方の列がcolumn-definitionタグ内に記述されている点に注目してください。
<metadata>
<column-count>2</column-count>
<column-definition>
<column-index>1</column-index>
<auto-increment>false</auto-increment>
<case-sensitive>true</case-sensitive>
<currency>false</currency>
<nullable>1</nullable>
<signed>false</signed>
<searchable>true</searchable>
<column-display-size>10</column-display-size>
<column-label>COL1</column-label>
<column-name>COL1</column-name>
<schema-name/>
<column-precision>10</column-precision>
<column-scale>0</column-scale>
<table-name/>
<catalog-name/>
<column-type>1</column-type>
<column-type-name>CHAR</column-type-name>
</column-definition>
<column-definition>
<column-index>2</column-index>
<auto-increment>false</auto-increment>
<case-sensitive>false</case-sensitive>
<currency>false</currency>
<nullable>1</nullable>
<signed>true</signed>
<searchable>true</searchable>
<column-display-size>39</column-display-size>
<column-label>COL2</column-label>
<column-name>COL2</column-name>
<schema-name/>
<column-precision>38</column-precision>
<column-scale>0</column-scale>
<table-name/>
<catalog-name/>
<column-type>3</column-type>
<column-type-name>NUMBER</column-type-name>
</column-definition>
</metadata>
プロパティとメタデータの記述内容を確認したところで、次にWebRowSetオブジェクトのコンテンツをXMLで記述する方法について見ていきます。 これは、インスタンスを生成してから一切変更されていないWebRowSetオブジェクトを説明しています。 currentRowタグは、WebRowSetオブジェクトの表構造の各行に対応しています。 columnValueタグには、XML値のマップ先のSQL型によって、stringDataまたはbinaryDataタグが入ります。 binaryDataタグは通常、BLOBまたはCLOB型データ用です。ここには、Base64エンコード方式のデータが入ります。
<data>
<currentRow>
<columnValue>
firstrow
</columnValue>
<columnValue>
1
</columnValue>
</currentRow>
<currentRow>
<columnValue>
secondrow
</columnValue>
<columnValue>
2
</columnValue>
</currentRow>
<currentRow>
<columnValue>
thirdrow
</columnValue>
<columnValue>
3
</columnValue>
</currentRow>
<currentRow>
<columnValue>
fourthrow
</columnValue>
<columnValue>
4
</columnValue>
</currentRow>
</data>
WebRowSetオブジェクトの行の削除では、ほかのRowSetオブジェクトと同様に、単に削除する行に移動し、deleteRowメソッドを呼び出すだけです。 次の2行のコード(この中ではwrsがWebRowSetオブジェクト)で3行目を削除します。
wrs.absolute(3);
wrs.deleteRow();
XMLの記述では、3行目にdeleteRowというマークが付きWebRowSetオブジェクトの3行目が排除されます。
<data>
<currentRow>
<columnValue>
firstrow
</columnValue>
<columnValue>
1
</columnValue>
</currentRow>
<currentRow>
<columnValue>
secondrow
</columnValue>
<columnValue>
2
</columnValue>
</currentRow>
<deleteRow>
<columnValue>
thirdrow
</columnValue>
<columnValue>
3
</columnValue>
</deleteRow>
<currentRow>
<columnValue>
fourthrow
</columnValue>
<columnValue>
4
</columnValue>
</currentRow>
</data>
WebRowSetオブジェクトは、挿入行に移動して、行の各列に対して適切な更新メソッドを呼び出し、insertRowメソッドを呼び出すことによって、新しい行を挿入できます。
wrs.moveToInsertRow();
wrs.updateString(1, "fifththrow");
wrs.updateString(2, "5");
wrs.insertRow();
次のコードの抜粋では、挿入したばかりの行の2列目の値を変更しています。 このコードは、現在の行の直後に新しい行が挿入された場合に適用されます。このため、nextメソッドでカーソルを正しい行に移動しています。 acceptChangesメソッドを呼び出すことで、変更をデータ・ソースに書き込みます。
wrs.moveToCurrentRow();
wrs.next();
wrs.updateString(2, "V");
wrs.acceptChanges();
これをXMLで記述し、どこで、Javaコードによって新しい行が挿入され、各フィールドに新しく挿入された行が更新されるかを示します。
<data>
<currentRow>
<columnValue>
firstrow
</columnValue>
<columnValue>
1
</columnValue>
</currentRow>
<currentRow>
<columnValue>
secondrow
</columnValue>
<columnValue>
2
</columnValue>
</currentRow>
<currentRow>
<columnValue>
newthirdrow
</columnValue>
<columnValue>
III
</columnValue>
</currentRow>
<insertRow>
<columnValue>
fifthrow
</columnValue>
<columnValue>
5
</columnValue>
<updateValue>
V
</updateValue>
</insertRow>
<currentRow>
<columnValue>
fourthrow
</columnValue>
<columnValue>
4
</columnValue>
</currentRow>
</date>
wrs.absolute(5);
wrs.updateString(1, "new4thRow");
wrs.updateString(2, "IV");
wrs.updateRow();
この処理は、XMLではmodifyRowタグで記述されます。 元の行を追跡できるように、タグ内には元の値と新しい値の両方が入ります。
<data>
<currentRow>
<columnValue>
firstrow
</columnValue>
<columnValue>
1
</columnValue>
</currentRow>
<currentRow>
<columnValue>
secondrow
</columnValue>
<columnValue>
2
</columnValue>
</currentRow>
<currentRow>
<columnValue>
newthirdrow
</columnValue>
<columnValue>
III
</columnValue>
</currentRow>
<currentRow>
<columnValue>
fifthrow
</columnValue>
<columnValue>
5
</columnValue>
</currentRow>
<modifyRow>
<columnValue>
fourthrow
</columnValue>
<updateValue>
new4thRow
</updateValue>
<columnValue>
4
</columnValue>
<updateValue>
IV
</updateValue>
</modifyRow>
</data>
| 修飾子と型 | フィールド | 説明 |
|---|---|---|
static String |
PUBLIC_XML_SCHEMA |
XMLタグと、これらのXMLタグの
WebRowSet実装での有効値を定義する、XMLスキーマ定義の公開識別子です。 |
static String |
SCHEMA_SYSTEM_ID |
XMLタグと、これらのXMLタグの
WebRowSet実装での有効値を定義する、XMLスキーマ定義のURLです。 |
COMMIT_ON_ACCEPT_CHANGESCLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE| 修飾子と型 | メソッド | 説明 |
|---|---|---|
void |
readXml(InputStream iStream) |
ストリーム・ベースのXML入力を読み込み、この
WebRowSetオブジェクトを生成します。 |
void |
readXml(Reader reader) |
指定された
Readerオブジェクトから、XML形式でWebRowSetオブジェクトを読み取ります。 |
void |
writeXml(OutputStream oStream) |
この
WebRowSetオブジェクトのデータ、プロパティ、メタデータを指定されたOutputStreamオブジェクトにXML形式で書き込みます。 |
void |
writeXml(ResultSet rs, OutputStream oStream) |
指定された
ResultSetオブジェクトの内容からこのWebRowSetオブジェクトを生成し、そのデータ、プロパティ、およびメタデータを指定されたOutputStreamオブジェクトにXML形式で書き込みます。 |
void |
writeXml(ResultSet rs, Writer writer) |
指定された
ResultSetオブジェクトの内容からこのWebRowSetオブジェクトを生成し、そのデータ、プロパティ、およびメタデータを指定されたWriterオブジェクトにXML形式で書き込みます。 |
void |
writeXml(Writer writer) |
この
WebRowSetオブジェクトのデータ、プロパティ、メタデータを指定されたWriterオブジェクトにXML形式で書き込みます。 |
acceptChanges, acceptChanges, columnUpdated, columnUpdated, commit, createCopy, createCopyNoConstraints, createCopySchema, createShared, execute, getKeyColumns, getOriginal, getOriginalRow, getPageSize, getRowSetWarnings, getShowDeleted, getSyncProvider, getTableName, nextPage, populate, populate, previousPage, release, restoreOriginal, rollback, rollback, rowSetPopulated, setKeyColumns, setMetaData, setOriginalRow, setPageSize, setShowDeleted, setSyncProvider, setTableName, size, toCollection, toCollection, toCollection, undoDelete, undoInsert, undoUpdateaddRowSetListener, clearParameters, execute, getCommand, getDataSourceName, getEscapeProcessing, getMaxFieldSize, getMaxRows, getPassword, getQueryTimeout, getTransactionIsolation, getTypeMap, getUrl, getUsername, isReadOnly, removeRowSetListener, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBlob, setBlob, setBlob, setBoolean, setBoolean, setByte, setByte, setBytes, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setClob, setClob, setClob, setCommand, setConcurrency, setDataSourceName, setDate, setDate, setDate, setDate, setDouble, setDouble, setEscapeProcessing, setFloat, setFloat, setInt, setInt, setLong, setLong, setMaxFieldSize, setMaxRows, setNCharacterStream, setNCharacterStream, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNClob, setNClob, setNClob, setNString, setNString, setNull, setNull, setNull, setNull, setObject, setObject, setObject, setObject, setObject, setObject, setPassword, setQueryTimeout, setReadOnly, setRef, setRowId, setRowId, setShort, setShort, setSQLXML, setSQLXML, setString, setString, setTime, setTime, setTime, setTime, setTimestamp, setTimestamp, setTimestamp, setTimestamp, setTransactionIsolation, setType, setTypeMap, setURL, setUrl, setUsernameabsolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, close, deleteRow, findColumn, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getConcurrency, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFetchSize, getFloat, getFloat, getHoldability, getInt, getInt, getLong, getLong, getMetaData, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getObject, getObject, getRef, getRef, getRow, getRowId, getRowId, getShort, getShort, getSQLXML, getSQLXML, getStatement, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, last, moveToCurrentRow, moveToInsertRow, next, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateRowId, updateRowId, updateShort, updateShort, updateSQLXML, updateSQLXML, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp, wasNullisWrapperFor, unwrapgetMatchColumnIndexes, getMatchColumnNames, setMatchColumn, setMatchColumn, setMatchColumn, setMatchColumn, unsetMatchColumn, unsetMatchColumn, unsetMatchColumn, unsetMatchColumnstatic final String PUBLIC_XML_SCHEMA
WebRowSet実装での有効値を定義する、XMLスキーマ定義の公開識別子です。void readXml(Reader reader) throws SQLException
Readerオブジェクトから、XML形式でWebRowSetオブジェクトを読み取ります。reader - java.io.Readerストリーム。ここからWebRowSetオブジェクトが生成されるSQLException - データベース・アクセス・エラーが発生した場合void readXml(InputStream iStream) throws SQLException, IOException
WebRowSetオブジェクトを生成します。iStream - java.io.InputStreamストリーム。ここからWebRowSetオブジェクトが生成されるSQLException - データ・ソース・アクセス・エラーが発生した場合IOException - IO例外が発生した場合void writeXml(ResultSet rs, Writer writer) throws SQLException
ResultSetオブジェクトの内容からこのWebRowSetオブジェクトを生成し、そのデータ、プロパティ、およびメタデータを指定されたWriterオブジェクトにXML形式で書き込みます。
ノート: WebRowSetカーソルは、XMLデータ・ソースへコンテンツを書き出すために移動するかもしれません。 このように実装されている場合、カーソルを、writeXml()呼出しの直前の位置に戻す必要があります。
rs - このWebRowSetオブジェクトを生成するResultSetオブジェクトwriter - 書き込むjava.io.Writerオブジェクト。SQLException - 行セットのコンテンツをXML形式で書き出すときにエラーが発生した場合void writeXml(ResultSet rs, OutputStream oStream) throws SQLException, IOException
ResultSetオブジェクトの内容からこのWebRowSetオブジェクトを生成し、そのデータ、プロパティ、およびメタデータを指定されたOutputStreamオブジェクトにXML形式で書き込みます。
ノート: WebRowSetカーソルは、XMLデータ・ソースへコンテンツを書き出すために移動するかもしれません。 このように実装されている場合、カーソルを、writeXml()呼出しの直前の位置に戻す必要があります。
rs - このWebRowSetオブジェクトを生成するResultSetオブジェクトoStream - 書込み先のjava.io.OutputStreamSQLException - データ・ソース・アクセス・エラーが発生した場合IOException - IO例外が発生した場合void writeXml(Writer writer) throws SQLException
WebRowSetオブジェクトのデータ、プロパティ、メタデータを指定されたWriterオブジェクトにXML形式で書き込みます。writer - 書込み先のjava.io.WriterストリームSQLException - 行セットのコンテンツをXMLへ書き出すときにエラーが発生した場合void writeXml(OutputStream oStream) throws SQLException, IOException
WebRowSetオブジェクトのデータ、プロパティ、メタデータを指定されたOutputStreamオブジェクトにXML形式で書き込みます。oStream - 書込み先のjava.io.OutputStreamストリームSQLException - データ・ソース・アクセス・エラーが発生した場合IOException - IO例外が発生した場合 バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。 そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Documentation Redistribution Policyも参照してください。