Home » Mojarra-2.0.1 » javax » faces » model » [javadoc | source]
javax.faces.model
public class: ResultSetDataModel [javadoc | source]
java.lang.Object
   javax.faces.model.DataModel<String, Object>
      javax.faces.model.ResultSetDataModel

All Implemented Interfaces:
    Iterable

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.

Constructor:
 public ResultSetDataModel() 
 public ResultSetDataModel(ResultSet resultSet) 
    Parameters:
    resultSet - ResultSet to be wrapped (if any)
Method from javax.faces.model.ResultSetDataModel Summary:
getRowCount,   getRowData,   getRowIndex,   getWrappedData,   isRowAvailable,   setRowIndex,   setWrappedData
Methods from javax.faces.model.DataModel:
addDataModelListener,   getDataModelListeners,   getRowCount,   getRowData,   getRowIndex,   getWrappedData,   isRowAvailable,   iterator,   removeDataModelListener,   setRowIndex,   setWrappedData
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.faces.model.ResultSetDataModel Detail:
 public int 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() 

    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. If no wrapped data is available, return null.

    If a non-null Map is returned, its behavior must correspond to the contract for a mutable Map as described in the JavaDocs for AbstractMap, with the following exceptions and specialized behavior:

    • The Map, and any supporting objects it returns, must perform all column name comparisons in a case-insensitive manner. This case-insensitivity must be implemented using a case-insensitive Comparator, such as String.CASE_INSENSITIVE_ORDER.
    • The following methods must throw UnsupportedOperationException: clear(), remove().
    • The entrySet() method must return a Set that has the following behavior:
      • Throw UnsupportedOperationException for any attempt to add or remove entries from the Set, either directly or indirectly through an Iterator returned by the Set.
      • Updates to the value of an entry in this set must write through to the corresponding column value in the underlying ResultSet.
    • The keySet() method must return a Set that throws UnsupportedOperationException on any attempt to add or remove keys, either directly or through an Iterator returned by the Set.
    • The put() method must throw IllegalArgumentException if a key value for which containsKey() returns false is specified. However, if a key already present in the Map is specified, the specified value must write through to the corresponding column value in the underlying ResultSet.
    • The values() method must return a Collection that throws UnsupportedOperationException on any attempt to add or remove values, either directly or through an Iterator returned by the Collection.
 public int getRowIndex() 
 public Object getWrappedData() 
 public boolean 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. Otherwise, return false.

 public  void setRowIndex(int rowIndex) 
 public  void setWrappedData(Object data)