JoinRowSet (Java Platform SE 8 )

download JoinRowSet (Java Platform SE 8 )

of 17

Transcript of JoinRowSet (Java Platform SE 8 )

  • 7/23/2019 JoinRowSet (Java Platform SE 8 )

    1/17

    OVERVIEW PACKAGE CLASS USE TREE DEPRECATED INDEX HELP

    Java Platform

    Standard Ed. 8

    PREV CLASS NEXT CLASS FRAMES NO FRAMES ALL CLASSES

    SUMMARY: NESTED | FIELD| CONSTR | METHOD DETAIL: FIELD| CONSTR | METHOD

    compact3

    javax.sql.rowset

    Interface JoinRowSet

    All Superinterfaces:

    AutoCloseable, CachedRowSet, Joinable, ResultSet, RowSet, WebRowSet,

    Wrapper

    public interface JoinRowSetextends WebRowSet

    The JoinRowSetinterface provides a mechanism for combining related data from

    different RowSetobjects into one JoinRowSetobject, which represents an SQL

    JOIN. In other words, a JoinRowSetobject acts as a container for the data from

    RowSetobjects that form an SQL JOINrelationship.

    The Joinableinterface provides the methods for setting, retrieving, and unsetting

    a match column, the basis for establishing an SQL JOINrelationship. The match

    column may alternatively be set by supplying it to the appropriate version of the

    JointRowSetmethod addRowSet.

    1.0 Overview

    Disconnected RowSetobjects (CachedRowSetobjects and implementations

    extending the CachedRowSetinterface) do not have a standard way to establish an

    SQL JOINbetween RowSetobjects without the expensive operation of reconnecting

    to the data source. The JoinRowSetinterface is specifically designed to address this

    need.

    Any RowSetobject can be added to a JoinRowSetobject to become part of an SQLJOINrelationship. This means that both connected and disconnected RowSetobjects

    can be part of a JOIN. RowSetobjects operating in a connected environment

    (JdbcRowSetobjects) are encouraged to use the database to which they are already

    connected to establish SQL JOINrelationships between tables directly. However, it

    is possible for a JdbcRowSetobject to be added to a JoinRowSetobject if necessary.

    Any number of RowSetobjects can be added to an instance of JoinRowSetprovided

    that they can be related in an SQL JOIN. By definition, the SQL JOINstatement is

    used to combine the data contained in two or more relational database tables based

    upon a common attribute. The Joinableinterface provides the methods forestablishing a common attribute, which is done by setting a match column. The

  • 7/23/2019 JoinRowSet (Java Platform SE 8 )

    2/17

    match column commonly coincides with the primary key, but there is no

    requirement that the match column be the same as the primary key. By establishing

    and then enforcing column matches, a JoinRowSetobject establishes JOIN

    relationships between RowSetobjects without the assistance of an available

    relational database.

    The type of JOINto be established is determined by setting one of the JoinRowSetconstants using the method setJoinType. The following SQL JOINtypes can be set:

    CROSS_JOIN

    FULL_JOIN

    INNER_JOIN- the default if no JOINtype has been set

    LEFT_OUTER_JOIN

    RIGHT_OUTER_JOIN

    Note that if no type is set, the JOINwill automatically be an inner join. The

    comments for the fields in the JoinRowSetinterface explain these JOINtypes,

    which are standard SQL JOINtypes.

    2.0 Using a JoinRowSetObject for Creating a JOIN

    When a JoinRowSetobject is created, it is empty. The first RowSetobject to be

    added becomes the basis for the JOINrelationship. Applications must determine

    which column in each of the RowSetobjects to be added to the JoinRowSetobject

    should be the match column. All of the RowSetobjects must contain a match

    column, and the values in each match column must be ones that can be compared

    to values in the other match columns. The columns do not have to have the same

    name, though they often do, and they do not have to store the exact same data typeas long as the data types can be compared.

    A match column can be be set in two ways:

    By calling the Joinablemethod setMatchColumn

    This is the only method that can set the match column before a RowSetobject

    is added to a JoinRowSetobject. The RowSetobject must have implemented

    the Joinableinterface in order to use the method setMatchColumn. Once the

    match column value has been set, this method can be used to reset the match

    column at any time.

    By calling one of the versions of the JoinRowSetmethod addRowSetthat takesa column name or number (or an array of column names or numbers)

    Four of the five addRowSetmethods take a match column as a parameter.

    These four methods set or reset the match column at the time a RowSetobject

    is being added to a JoinRowSetobject.

    3.0 Sample Usage

    The following code fragment adds two CachedRowSetobjects to a JoinRowSet

    object. Note that in this example, no SQL JOINtype is set, so the default JOINtype,

    which isINNER_JOIN, is established.

  • 7/23/2019 JoinRowSet (Java Platform SE 8 )

    3/17

    In the following code fragment, the table EMPLOYEES, whose match column is set to

    the first column (EMP_ID), is added to the JoinRowSetobjectjrs. Then the table

    ESSP_BONUS_PLAN, whose match column is likewise the EMP_IDcolumn, is added.

    When this second table is added tojrs, only the rows in ESSP_BONUS_PLANwhose

    EMP_IDvalue matches an EMP_IDvalue in the EMPLOYEEStable are added. In this

    case, everyone in the bonus plan is an employee, so all of the rows in the table

    ESSP_BONUS_PLANare added to the JoinRowSetobject. In this example, both

    CachedRowSetobjects being added have implemented the Joinableinterface and

    can therefore call the Joinablemethod setMatchColumn.

    JoinRowSet jrs = new JoinRowSetImpl();

    ResultSet rs1 = stmt.executeQuery("SELECT * FROM EMPLOYEES");

    CachedRowSet empl = new CachedRowSetImpl();

    empl.populate(rs1);

    empl.setMatchColumn(1);

    jrs.addRowSet(empl);

    ResultSet rs2 = stmt.executeQuery("SELECT * FROM ESSP_BONUS_PLAN");

    CachedRowSet bonus = new CachedRowSetImpl();

    bonus.populate(rs2);

    bonus.setMatchColumn(1); // EMP_ID is the first column

    jrs.addRowSet(bonus);

    At this point,jrsis an inside JOIN of the two RowSetobjects based on their EMP_ID

    columns. The application can now browse the combined data as if it were browsing

    one single RowSetobject. Becausejrsis itself a RowSetobject, an application can

    navigate or modify it using RowSetmethods.

    jrs.first();

    int employeeID = jrs.getInt(1);

    String employeeName = jrs.getString(2);

    Note that because the SQL JOINmust be enforced when an application adds a

    second or subsequent RowSetobject, there may be an initial degradation in

    performance while the JOINis being performed.

    The following code fragment adds an additional CachedRowSetobject. In this case,

    the match column (EMP_ID) is set when the CachedRowSetobject is added to the

    JoinRowSetobject.

    ResultSet rs3 = stmt.executeQuery("SELECT * FROM 401K_CONTRIB");

    CachedRowSet fourO1k = new CachedRowSetImpl();

    four01k.populate(rs3);

    jrs.addRowSet(four01k, 1);

  • 7/23/2019 JoinRowSet (Java Platform SE 8 )

    4/17

    The JoinRowSetobjectjrsnow contains values from all three tables. The data in

    each row infour01kin which the value for the EMP_IDcolumn matches a value for

    the EMP_IDcolumn injrshas been added tojrs.

    4.0 JoinRowSetMethods

    The JoinRowSetinterface supplies several methods for adding RowSetobjects andfor getting information about the JoinRowSetobject.

    Methods for adding one or more RowSetobjects

    These methods allow an application to add one RowSetobject at a time or to

    add multiple RowSetobjects at one time. In either case, the methods may

    specify the match column for each RowSetobject being added.

    Methods for getting information

    One method retrieves the RowSetobjects in the JoinRowSetobject, and

    another method retrieves the RowSetnames. A third method retrieves either

    the SQL WHEREclause used behind the scenes to form the JOINor a text

    description of what the WHEREclause does.Methods related to the type of JOIN

    One method sets the JOINtype, and five methods find out whether the

    JoinRowSetobject supports a given type.

    A method to make a separate copy of the JoinRowSetobject

    This method creates a copy that can be persisted to the data source.

    Field Summary

    Modifier and Type Field and Description

    static int CROSS_JOIN

    An ANSI-style JOINproviding a cross product of two

    tables

    static int FULL_JOIN

    An ANSI-style JOINproviding a a full JOIN.

    static int INNER_JOIN

    An ANSI-style JOINproviding a inner join between two

    tables.

    static int LEFT_OUTER_JOIN

    An ANSI-style JOINproviding a left outer join between

    two tables.

    static int RIGHT_OUTER_JOIN

    An ANSI-style JOINproviding a right outer join between

    two tables.

    Fields

  • 7/23/2019 JoinRowSet (Java Platform SE 8 )

    5/17

    Fields inherited from interface javax.sql.rowset.WebRowSet

    PUBLIC_XML_SCHEMA, SCHEMA_SYSTEM_ID

    Fields inherited from

    interface javax.sql.rowset.CachedRowSet

    COMMIT_ON_ACCEPT_CHANGES

    Fields inherited from interface java.sql.ResultSet

    CLOSE_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

    Method Summary

    Modifier and Type Method and Description

    void addRowSet(Joinablerowset)

    Adds the given RowSetobject to this JoinRowSetobject.

    void addRowSet(RowSet[] rowset, int[] columnIdx)

    Adds one or more RowSetobjects contained in the given

    array of RowSetobjects to this JoinRowSetobject and

    sets the match column for each of the RowSetobjects to

    the match columns in the given array of column indexes.

    void addRowSet(RowSet[] rowset, String[] columnName)

    Adds one or more RowSetobjects contained in the given

    array of RowSetobjects to this JoinRowSetobject and

    sets the match column for each of the RowSetobjects to

    the match columns in the given array of column names.

    void addRowSet(RowSetrowset, int columnIdx)

    Adds the given RowSetobject to this JoinRowSetobject

    and sets the designated column as the match column for

    the RowSetobject.

    void addRowSet(RowSetrowset, StringcolumnName)

    Adds rowsetto this JoinRowSetobject and sets the

    designated column as the match column.

    All Methods Instance Methods Abstract Methods

  • 7/23/2019 JoinRowSet (Java Platform SE 8 )

    6/17

    int getJoinType()

    Returns a intdescribing the set SQL JOINtype

    governing this JoinRowSet instance.

    String[] getRowSetNames()

    Returns a Stringarray containing the names of the

    RowSetobjects added to this JoinRowSetobject.

    Collection getRowSets()

    Returns a Collectionobject containing the RowSet

    objects that have been added to this JoinRowSetobject.

    String getWhereClause()

    Return a SQL-like description of the WHERE clause

    being used in a JoinRowSet object.

    void setJoinType(int joinType)Allow the application to adjust the type of JOINimposed

    on tables contained within the JoinRowSet object

    instance.

    boolean supportsCrossJoin()

    Indicates if CROSS_JOIN is supported by a JoinRowSet

    implementation

    boolean supportsFullJoin()

    Indicates if FULL_JOIN is supported by a JoinRowSet

    implementation

    boolean supportsInnerJoin()

    Indicates if INNER_JOIN is supported by a JoinRowSet

    implementation

    boolean supportsLeftOuterJoin()

    Indicates if LEFT_OUTER_JOIN is supported by a

    JoinRowSet implementation

    boolean supportsRightOuterJoin()Indicates if RIGHT_OUTER_JOIN is supported by a

    JoinRowSet implementation

    CachedRowSet toCachedRowSet()

    Creates a new CachedRowSetobject containing the data

    in this JoinRowSetobject, which can be saved to a data

    source using the SyncProviderobject for the

    CachedRowSetobject.

    Methods inherited from

  • 7/23/2019 JoinRowSet (Java Platform SE 8 )

    7/17

    interface javax.sql.rowset.WebRowSet

    readXml, readXml, writeXml, writeXml, writeXml, writeXml

    Methods inherited from

    interface javax.sql.rowset.CachedRowSetacceptChanges, 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, undoUpdate

    Methods inherited from interface javax.sql.RowSet

    addRowSetListener, 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, setUsername

    Methods inherited from interface java.sql.ResultSet

    absolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings,

  • 7/23/2019 JoinRowSet (Java Platform SE 8 )

    8/17

    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, wasNull

    Methods inherited from interface java.sql.Wrapper

    isWrapperFor, unwrap

  • 7/23/2019 JoinRowSet (Java Platform SE 8 )

    9/17

    Methods inherited from interface javax.sql.rowset.Joinable

    getMatchColumnIndexes, getMatchColumnNames, setMatchColumn,

    setMatchColumn, setMatchColumn, setMatchColumn, unsetMatchColumn,

    unsetMatchColumn, unsetMatchColumn, unsetMatchColumn

    Field Detail

    CROSS_JOIN

    static final int CROSS_JOIN

    An ANSI-style JOINproviding a cross product of two tables

    See Also:Constant Field Values

    INNER_JOIN

    static final int INNER_JOIN

    An ANSI-style JOINproviding a inner join between two tables. Any unmatched

    rows in either table of the join should be discarded.

    See Also:

    Constant Field Values

    LEFT_OUTER_JOIN

    static final int LEFT_OUTER_JOIN

    An ANSI-style JOINproviding a left outer join between two tables. In SQL,

    this is described where all records should be returned from the left side of the

    JOIN statement.

    See Also:

    Constant Field Values

    RIGHT_OUTER_JOIN

    static final int RIGHT_OUTER_JOIN

    An ANSI-style JOINproviding a right outer join between two tables. In SQL,

    this is described where all records from the table on the right side of the JOIN

  • 7/23/2019 JoinRowSet (Java Platform SE 8 )

    10/17

    statement even if the table on the left has no matching record.

    See Also:

    Constant Field Values

    FULL_JOIN

    static final int FULL_JOIN

    An ANSI-style JOINproviding a a full JOIN. Specifies that all rows from either

    table be returned regardless of matching records on the other table.

    See Also:

    Constant Field Values

    Method Detail

    addRowSet

    void addRowSet(Joinablerowset)

    throws SQLException

    Adds the given RowSetobject to this JoinRowSetobject. If the RowSetobject

    is the first to be added to this JoinRowSetobject, it forms the basis of the

    JOINrelationship to be established.

    This method should be used only when the given RowSetobject already has a

    match column that was set with the Joinablemethod setMatchColumn.

    Note: A Joinableobject is any RowSetobject that has implemented the

    Joinableinterface.

    Parameters:

    rowset - the RowSet object that is to be added to this JoinRowSet

    object; it must implement the Joinable interface and have a matchcolumn set

    Throws:

    SQLException- if (1) an empty rowset is added to the to this

    JoinRowSet object, (2) a match column has not been set for rowset,

    or (3) rowsetviolates the active JOIN

    See Also:

    Joinable.setMatchColumn(int)

  • 7/23/2019 JoinRowSet (Java Platform SE 8 )

    11/17

    addRowSet

    void addRowSet(RowSetrowset,

    int columnIdx)

    throws SQLException

    Adds the given RowSetobject to this JoinRowSetobject and sets the

    designated column as the match column for the RowSetobject. If the RowSet

    object is the first to be added to this JoinRowSetobject, it forms the basis of

    the JOINrelationship to be established.

    This method should be used whenRowSetdoes not already have a match

    column set.

    Parameters:

    rowset - the RowSet object that is to be added to this JoinRowSet

    object; it may implement the Joinable interface

    columnIdx - an int that identifies the column to become the match

    column

    Throws:

    SQLException- if (1) rowsetis an empty rowset or (2) rowset

    violates the active JOIN

    See Also:

    Joinable.unsetMatchColumn(int)

    addRowSet

    void addRowSet(RowSetrowset,

    StringcolumnName)

    throws SQLException

    Adds rowsetto this JoinRowSetobject and sets the designated column as the

    match column. If rowsetis the first to be added to this JoinRowSetobject, it

    forms the basis for the JOINrelationship to be established.

    This method should be used when the given RowSetobject does not already

    have a match column.

    Parameters:

    rowset - the RowSet object that is to be added to this JoinRowSet

    object; it may implement the Joinable interface

    columnName - the String object giving the name of the column to be

    set as the match column

    Throws:

    SQLException- if (1) rowsetis an empty rowset or (2) the match

  • 7/23/2019 JoinRowSet (Java Platform SE 8 )

    12/17

    column for rowsetdoes not satisfy the conditions of the JOIN

    addRowSet

    void addRowSet(RowSet[] rowset,

    int[] columnIdx) throws SQLException

    Adds one or more RowSetobjects contained in the given array of RowSet

    objects to this JoinRowSetobject and sets the match column for each of the

    RowSetobjects to the match columns in the given array of column indexes.

    The first element in columnIdxis set as the match column for the first RowSet

    object in rowset, the second element of columnIdxis set as the match column

    for the second element in rowset, and so on.

    The first RowSetobject added to this JoinRowSetobject forms the basis for

    the JOINrelationship.

    This method should be used when the given RowSetobject does not already

    have a match column.

    Parameters:

    rowset - an array of one or more RowSet objects to be added to the

    JOIN; it may implement the Joinable interface

    columnIdx - an array of int values indicating the index(es) of the

    columns to be set as the match columns for the RowSet objects in

    rowset

    Throws:

    SQLException- if (1) an empty rowset is added to this JoinRowSet

    object, (2) a match column is not set for a RowSet object in

    rowset, or (3) a RowSet object being added violates the active JOIN

    addRowSet

    void addRowSet(RowSet[] rowset, String[] columnName)

    throws SQLException

    Adds one or more RowSetobjects contained in the given array of RowSet

    objects to this JoinRowSetobject and sets the match column for each of the

    RowSetobjects to the match columns in the given array of column names. The

    first element in columnNameis set as the match column for the first RowSet

    object in rowset, the second element of columnNameis set as the match

    column for the second element in rowset, and so on.

    The first RowSetobject added to this JoinRowSetobject forms the basis for

  • 7/23/2019 JoinRowSet (Java Platform SE 8 )

    13/17

    the JOINrelationship.

    This method should be used when the given RowSetobject(s) does not already

    have a match column.

    Parameters:

    rowset - an array of one or more RowSet objects to be added to theJOIN; it may implement the Joinable interface

    columnName - an array of String values indicating the names of the

    columns to be set as the match columns for the RowSet objects in

    rowset

    Throws:

    SQLException- if (1) an empty rowset is added to this JoinRowSet

    object, (2) a match column is not set for a RowSet object in

    rowset, or (3) a RowSet object being added violates the active JOIN

    getRowSets

    Collection getRowSets()

    throws SQLException

    Returns a Collectionobject containing the RowSetobjects that have been

    added to this JoinRowSetobject. This should return the 'n' number of RowSet

    contained within the JOINand maintain any updates that have occurred while

    in this union.

    Returns:

    a Collection object consisting of the RowSet objects added to this

    JoinRowSet object

    Throws:

    SQLException- if an error occurs generating the Collection object

    to be returned

    getRowSetNames

    String[] getRowSetNames()

    throws SQLException

    Returns a Stringarray containing the names of the RowSetobjects added to

    this JoinRowSetobject.

    Returns:

    a String array of the names of the RowSet objects in this

    JoinRowSet object

    Throws:

  • 7/23/2019 JoinRowSet (Java Platform SE 8 )

    14/17

    SQLException- if an error occurs retrieving the names of the

    RowSet objects

    See Also:

    CachedRowSet.setTableName(java.lang.String)

    toCachedRowSet

    CachedRowSettoCachedRowSet()

    throws SQLException

    Creates a new CachedRowSetobject containing the data in this JoinRowSet

    object, which can be saved to a data source using the SyncProviderobject for

    the CachedRowSetobject.

    If any updates or modifications have been applied to the JoinRowSet the

    CachedRowSet returned by the method will not be able to persist it's changesback to the originating rows and tables in the in the datasource. The

    CachedRowSet instance returned should not contain modification data and it

    should clear all properties of it's originating SQL statement. An application

    should reset the SQL statement using the RowSet.setCommandmethod.

    In order to allow changes to be persisted back to the datasource to the

    originating tables, the acceptChangesmethod should be used and called on a

    JoinRowSet object instance. Implementations can leverage the internal data

    and update tracking in their implementations to interact with the

    SyncProvider to persist any changes.

    Returns:

    a CachedRowSet containing the contents of the JoinRowSet

    Throws:

    SQLException- if an error occurs assembling the CachedRowSet

    object

    See Also:

    RowSet, CachedRowSet, SyncProvider

    supportsCrossJoin

    boolean supportsCrossJoin()

    Indicates if CROSS_JOIN is supported by a JoinRowSet implementation

    Returns:

    true if the CROSS_JOIN is supported; false otherwise

  • 7/23/2019 JoinRowSet (Java Platform SE 8 )

    15/17

    supportsInnerJoin

    boolean supportsInnerJoin()

    Indicates if INNER_JOIN is supported by a JoinRowSet implementation

    Returns:true is the INNER_JOIN is supported; false otherwise

    supportsLeftOuterJoin

    boolean supportsLeftOuterJoin()

    Indicates if LEFT_OUTER_JOIN is supported by a JoinRowSet implementation

    Returns:

    true is the LEFT_OUTER_JOIN is supported; false otherwise

    supportsRightOuterJoin

    boolean supportsRightOuterJoin()

    Indicates if RIGHT_OUTER_JOIN is supported by a JoinRowSet

    implementation

    Returns:

    true is the RIGHT_OUTER_JOIN is supported; false otherwise

    supportsFullJoin

    boolean supportsFullJoin()

    Indicates if FULL_JOIN is supported by a JoinRowSet implementation

    Returns:

    true is the FULL_JOIN is supported; false otherwise

    setJoinType

    void setJoinType(int joinType)

    throws SQLException

    Allow the application to adjust the type of JOINimposed on tables contained

    within the JoinRowSet object instance. Implementations should throw a

    SQLException if they do not support a given JOINtype.

    Parameters:

  • 7/23/2019 JoinRowSet (Java Platform SE 8 )

    16/17

    joinType - the standard JoinRowSet.XXX static field definition of a

    SQL JOIN to re-configure a JoinRowSet instance on the fly.

    Throws:

    SQLException- if an unsupported JOIN type is set

    See Also:

    getJoinType()

    getWhereClause

    StringgetWhereClause()

    throws SQLException

    Return a SQL-like description of the WHERE clause being used in a

    JoinRowSet object. An implementation can describe the WHERE clause of the

    SQL JOINby supplying a SQL strings description of JOINor provide a textualdescription to assist applications using a JoinRowSet

    Returns:

    whereClause a textual or SQL description of the logical WHERE

    clause used in the JoinRowSet instance

    Throws:

    SQLException- if an error occurs in generating a representation of

    the WHERE clause.

    getJoinType

    int getJoinType()

    throws SQLException

    Returns a intdescribing the set SQL JOINtype governing this JoinRowSet

    instance. The returned type will be one of standard JoinRowSet types:

    CROSS_JOIN, INNER_JOIN, LEFT_OUTER_JOIN, RIGHT_OUTER_JOINor

    FULL_JOIN.

    Returns:

    joinType one of the standard JoinRowSet static field definitions of

    a SQL JOIN. JoinRowSet.INNER_JOIN is returned as the default JOIN

    type is no type has been explicitly set.

    Throws:

    SQLException- if an error occurs determining the SQL JOIN type

    supported by the JoinRowSet instance.

    See Also:

    setJoinType(int)

  • 7/23/2019 JoinRowSet (Java Platform SE 8 )

    17/17

    OVERVIEW PACKAGE CLASS USE TREE DEPRECATED INDEX HELPJava PlatformStandard Ed. 8

    PREV CLASS NEXT CLASS FRAMES NO FRAMES ALL CLASSES

    SUMMARY: NESTED | FIELD| CONSTR | METHOD DETAIL: FIELD| CONSTR | METHOD

    Submit a bug or feature

    For further API reference and developer documentation, seeJava SE Documentation. That

    documentation contains more detailed, developer-targeted descriptions, with conceptual

    overviews, definitions of terms, workarounds, and working code examples.

    Copyright 1993, 2015, Oracle and/or its affiliates. All rights reserved.