Joinable
Joinable (조인 가능)
매치 컬럼(match column)을 설정하고 얻기 위한 메서드를 제공하는 인터페이스입니다. 매치 컬럼은 RowSet 객체를 JoinRowSet 객체에 추가해 SQL JOIN을 만드는 기초가 됩니다.
본문
표준 RowSet 구현은 Joinable 인터페이스를 구현해 JoinRowSet 객체에 추가될 수 있습니다. 이 인터페이스를 구현하면 RowSet 객체는 매치 컬럼을 설정·조회·정보를 얻는 Joinable 메서드를 사용할 수 있게 됩니다.
Joinable 인터페이스를 구현하지 않은 RowSet 객체도 JoinRowSet 객체에 추가할 수 있지만, 그 경우에는 RowSet 객체와 매치 컬럼을(또는 RowSet 객체 배열과 매치 컬럼 배열을) 함께 받는 JoinRowSet.addRowSet 메서드 중 하나를 사용해야 해요.
Joinable 인터페이스의 메서드에 접근하려면 RowSet 객체가 다섯 개의 표준 RowSet 인터페이스 중 적어도 하나를 구현하면서 Joinable 인터페이스도 구현해야 합니다. 대부분의 RowSet 객체는 추가로 BaseRowSet 클래스를 확장합니다.
class MyRowSetImpl extends BaseRowSet implements CachedRowSet, Joinable {
// ...
}
Joinable의 메서드는 RowSet 객체가 SQL JOIN의 기초가 될 수 있는 매치 컬럼을 설정·조회·해제할 수 있게 해 줍니다. 이 메서드를 구현한 클래스의 인스턴스는 JoinRowSet 객체에 추가되어 SQL JOIN 관계를 맺을 수 있어요.
CachedRowSet crs = new MyRowSetImpl();
crs.populate((ResultSet) rs);
((Joinable) crs).setMatchColumnIndex(1);
JoinRowSet jrs = new JoinRowSetImpl();
jrs.addRowSet(crs);
Joinable을 구현하지 않은 crs2는 매치 컬럼을 addRowSet 메서드의 인자로 넘겨야 합니다.
void setMatchColumn(int columnIdx) throws SQLException
void setMatchColumn(int[] columnIdxes) throws SQLException
void setMatchColumn(String columnName) throws SQLException
void setMatchColumn(String[] columnNames) throws SQLException
int getMatchColumnIndex() throws SQLException
int[] getMatchColumnIndexes() throws SQLException
String getMatchColumnName() throws SQLException
String[] getMatchColumnNames() throws SQLException
void unsetMatchColumn(int columnIdx) throws SQLException
void unsetMatchColumn(int[] columnIdxes) throws SQLException
void unsetMatchColumn(String columnName) throws SQLException
void unsetMatchColumn(String[] columnNames) throws SQLException