public class HibernateGridDataSource extends Object implements GridDataSource
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 and Description |
---|
HibernateGridDataSource(org.hibernate.Session session,
Class entityType) |
Modifier and Type | Method and Description |
---|---|
protected void |
applyAdditionalConstraints(org.hibernate.Criteria crit)
Invoked after the main criteria has been set up (firstResult, maxResults and any sort contraints).
|
int |
getAvailableRows()
Returns the total number of rows for the configured entity type.
|
Class |
getRowType()
Returns the entity type, as provided via the constructor.
|
Object |
getRowValue(int index)
Returns a row value at the given index (which must be within the range defined by the call to
prepare(int, int, java.util.List) ). |
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).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAvailableRows, isEmpty
public HibernateGridDataSource(org.hibernate.Session session, Class entityType)
public int getAvailableRows()
getAvailableRows
in interface GridDataSource
public void prepare(int startIndex, int endIndex, List<SortConstraint> sortConstraints)
getRowValue(int)
}.prepare
in interface GridDataSource
startIndex
- index, from zero, of the first item to be retrievedendIndex
- index, from zero, of the last item to be retrievedsortConstraints
- zero or more constraints used to set the order of the returned valuesprotected void applyAdditionalConstraints(org.hibernate.Criteria crit)
public Object getRowValue(int index)
prepare(int, int, java.util.List)
).getRowValue
in interface GridDataSource
index
- of objectpublic Class getRowType()
getRowType
in interface GridDataSource
5.6.3 - Copyright © 2003-2021 The Apache Software Foundation.