When applying a constraint to HibernateGridDataSource which reduces the number of rows an java.lang.IndexOutOfBoundsException is thrown because getAvailableRows() does not take into account the number of rows with the additional criteria applied.
Lets say we have a table named foo with 10 entries in it and we extend the datagrid like so:
// for simplicity this would only return only 1 record in the table
protected void applyAdditionalConstraints(Criteria criteria)
criteria.add( Property.forName("id").equals(new Integer(1) );
so we end up with getAvilableRows() returning a value of 10 and the results of prepare() retrieving only 1 row.