Home » tapestry-src-5.0.19 » org.apache.tapestry5.hibernate » [javadoc | source]
org.apache.tapestry5.hibernate
public class: HibernateGridDataSource [javadoc | source]
java.lang.Object
   org.apache.tapestry5.hibernate.HibernateGridDataSource

All Implemented Interfaces:
    GridDataSource

A simple implementation of org.apache.tapestry5.grid.GridDataSource based on a Hibernate Session and a known entity class. This implementation does support multiple sort constraints ; however it assumes a direct mapping from sort constraint property to Hibernate property.

This class is not thread-safe; it maintains internal state.

Typically, an instance of this object is created fresh as needed (that is, it is not stored between requests).
Constructor:
 public HibernateGridDataSource(Session session,
    Class entityType) 
Method from org.apache.tapestry5.hibernate.HibernateGridDataSource Summary:
applyAdditionalConstraints,   getAvailableRows,   getRowType,   getRowValue,   prepare
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tapestry5.hibernate.HibernateGridDataSource Detail:
 protected  void applyAdditionalConstraints(Criteria crit) 
    Invoked after the main criteria has been set up (firstResult, maxResults and any sort contraints). This gives subclasses a chance to apply additional constraints before the list of results is obtained from the criteria. This implementation does nothing and may be overridden.
 public int getAvailableRows() 
    Returns the total number of rows for the configured entity type.
 public Class getRowType() 
    Returns the entity type, as provided via the constructor.
 public Object getRowValue(int index) 
 public  void prepare(int startIndex,
    int endIndex,
    List<SortConstraint> sortConstraints) 
    Prepares the results, performing a query (applying the sort results, and the provided start and end index). The results can later be obtained from #getRowValue(int) }.