Top Description Inners Fields Constructors Methods
jakarta.faces.model

public Class ResultSetDataModel

extends DataModel<Map<String, Object>>
Class Inheritance
Imports
java.io.IOException, .NotSerializableException, .ObjectInputStream, .ObjectOutputStream, java.sql.ResultSet, .ResultSetMetaData, .SQLException, java.util.AbstractCollection, .AbstractSet, .Collection, .Comparator, .Iterator, .Map, .Set, .TreeMap, jakarta.faces.FacesException

ResultSetDataModel is a convenience implementation of DataModel that wraps a ResultSet of Java objects. Note that the specified ResultSet MUST be scrollable. In addition, if input components (that will be updating model values) reference this object in value binding expressions, the specified ResultSet MUST be updatable.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private int
private ResultSetMetaData
private ResultSet
private boolean

Constructor Summary

AccessConstructor and Description
public
ResultSetDataModel()

Construct a new ResultSetDataModel with no specified wrapped data.

public
ResultSetDataModel(ResultSet
ResultSet to be wrapped (if any)
resultSet
)

Construct a new ResultSetDataModel wrapping the specified ResultSet.

Method Summary

Modifier and TypeMethod and Description
private ResultSetMetaData
getMetaData()

Return the ResultSetMetaData for the ResultSet we are wrapping, caching it the first time it is returned.

public int
getRowCount()

Implements abstract jakarta.faces.model.DataModel.getRowCount.

Return -1, since ResultSet does not provide a standard way to determine the number of available rows without scrolling through the entire ResultSet, and this can be very expensive if the number of rows is large.

public Map<String, Object>
getRowData()

Implements abstract jakarta.faces.model.DataModel.getRowData.

If row data is available, return a Map representing the values of the columns for the row specified by rowIndex, keyed by the corresponding column names.

public int
getRowIndex()

Implements abstract jakarta.faces.model.DataModel.getRowIndex.

Return the zero-relative index of the currently selected row.

public Object
getWrappedData()

Implements abstract jakarta.faces.model.DataModel.getWrappedData.

Return the object representing the data wrapped by this DataModel, if any.

public boolean
isRowAvailable()

Implements abstract jakarta.faces.model.DataModel.isRowAvailable.

Return true if there is wrappedData available, and the result of calling absolute() on the underlying ResultSet, passing the current value of rowIndex plus one (to account for the fact that ResultSet uses one-relative indexing), returns true.

public void
setRowIndex(int
The new zero-relative index (must be non-negative)
rowIndex
)

Implements abstract jakarta.faces.model.DataModel.setRowIndex.

Set the zero-relative index of the currently selected row, or -1 to indicate that we are not positioned on a row.

public void
setWrappedData(Object
Data collection to be wrapped, or null to detach from any previous data collection
data
)

Implements abstract jakarta.faces.model.DataModel.setWrappedData.

Set the object representing the data collection wrapped by this DataModel.

private void
updated()

Mark the current row as having been updated, so that we will call updateRow() before moving elsewhere.

Inherited from jakarta.faces.model.DataModel:
addDataModelListenergetDataModelListenersiteratorremoveDataModelListener