Java Reference
In-Depth Information
+ "FROM BOOK_AUTHOR BA, "
+ "AUTHOR_WORK AW, "
+ "BOOK B "
+ "WHERE AW.AUTHOR_ID = BA.ID "
+ "AND B.ID = AW.BOOK_ID");
frs.execute(conn);
System.out.println("Prior to adding filter:");
viewRowSet(frs);
System.out.println("Adding author filter:");
frs.beforeFirst();
frs.setFilter(authorFilter);
viewRowSet(frs);
} catch (SQLException e) {
e.printStackTrace();
}
}
public static void viewRowSet(RowSet rs) {
try {
while (rs.next()) {
System.out.println(rs.getString(1) + " - "
+ rs.getString(2));
}
} catch (SQLException ex) {
ex.printStackTrace();
}
}
}
The results of running this code would look similar to the following lines. Notice
that only the rows of data corresponding to the authors listed in the filter are returned
with the FilteredRowSet .
Successfully connected
Prior to adding filter:
Java 7 Recipes - JUNEAU
Search WWH ::




Custom Search