Name

ResultSetDataModel

Synopsis

This class wraps a java.sql.ResultSet to expose it as a DataModel for a UIData component. The ResultSet must be scrollable, and if the UIData component has input components bound to columns in this model, it must be updatable.

Class name:

javax.faces.model.ResultSetDataModel

Extends:

javax.faces.model.DataModel

Implements:

None

Constructors

public ResultSetDataModel()

Creates a new, empty instance.

public ResultSetDataModel(java.sql.ResultSet resultSet)

Creates a new instance wrapping a ResultSet instance.

Methods

public int getRowCount()

Returns -1 because the number of rows is unknown until all rows have been retrieved.

public Object getRowData()

Returns a java.util.Map with the column values for the columns in the current row, with the column names as case-insensitive keys, or null if the result set isn’t set or there’s no such row.

public int getRowIndex()

Returns the zero-based index for the current row or -1 if no row is selected.

public Object getWrappedData()

Returns the ResultSet instance or null if the result set isn’t set.

public boolean isRowAvailable()

Returns true if the result set is set and if calling the ResultSet absolute( ) method with current row index plus one returns true.

public void setRowIndex(int index)

Sets the zero-based index for the current row or to -1 if no row is selected.

public void setWrappedData(Object data)

Sets the ResultSet instance.

Get JavaServer Faces now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.