At this point, jrs is an inside JOIN of the two RowSet objects based on their EMP_ID columns. The application can now browse the combined data as if it were browsing one single RowSet object. Because jrs is itself a RowSet object, an application can navigate or modify it using RowSet methods.
jrs.first(); int employeeID = jrs.getInt(1); String employeeName = jrs.getString(2);
Note that because the SQL JOIN must be enforced when an application adds a second or subsequent RowSet object, there may be an initial degradation in performance while the JOIN is being performed.
The following code fragment adds an additional CachedRowSet object. In this case, the match column (EMP_ID) is set when the CachedRowSet object is added to the JoinRowSet object.
ResultSet rs3 = stmt.executeQuery("SELECT * FROM 401K_CONTRIB"); CachedRowSet fourO1k = new CachedRowSetImpl(); four01k.populate(rs3); jrs.addRowSet(four01k, 1); The JoinRowSet object jrs now contains values from all three tables. The data in each row in four01k in which the value for the EMP_ID column matches a value for the EMP_ID column in jrs has been added to jrs.
JoinRowSet MethodsJoinRowSet interface supplies several methods for adding RowSet objects and for getting information about the JoinRowSet object. RowSet objectsRowSet object at a time or to add multiple RowSet objects at one time. In either case, the methods may specify the match column for each RowSet object being added. RowSet objects in the JoinRowSet object, and another method retrieves the RowSet names. A third method retrieves either the SQL WHERE clause used behind the scenes to form the JOIN or a text description of what the WHERE clause does. JOINJOIN type, and five methods find out whether the JoinRowSet object supports a given type. JoinRowSet object | |
| |
| |
| |