Using HibernateGridDatasource
One of the easiest way to use the Grid Component with Hiberante, is to use the HibernateGridDatasource class, from the tapestry-hibernate module.
Consider this snippet of a page:
<t:grid t:source="list"/>
The Java class associated to the page is simply:
import org.apache.tapestry5.hibernate.HibernateGridDataSource;
...
@Inject
private Session session;
public GridDataSource getList() {
return new HibernateGridDataSource(session, Entity.class);
}
Note
There is a bug with new versions of Hybernate and the implementation of HibernateGridDatasource, that causes a ClassCastException. The bug should be fixed in Tapestry 5.2.