I am currently trying to build a page that will have a datatable that allows for filtering based on criteria set for each column. According to the documentation, the openfaces hibernateCriterionBuilder is the easiest way to accomplish this using hibernate. The builder works fine for sorting, but as soon as filtering criteria are passed it throws an error:
SEVERE: javax.el.ELException: /tools/orders/orderPicker.xhtml @24,168 value="#{orderPicker.orders}": org.hibernate.QueryException: could not resolve property: /tools/orders/orderPicker of: pojo.Orders
As far as I can tell this is a failure on part of the hibernateCriterionBuilder to properly parse the filtering data, which makes me suspect I am doing something wrong. The call to the builder is like so:
Session session = resources.HibernateUtil.getSessionFactory().openSession();
Criteria criteria = HibernateCriterionBuilder.buildCriteria(session, pojo.Orders.class);
orders = criteria.list();
From the following table:
<o:dataTable value="#{orderPicker.orders}" var="item" customDataProviding="true" totalRowCount="#{orderPicker.rowCount}" pageSize="10">
<o:column sortingExpression="#{item.distId}" id="distId" >
<f:facet name="header">
distId
</f:facet>
<f:facet name="subHeader">
<o:dropDownFieldFilter condition="beginsWith" />
开发者_如何学Python </f:facet>
<h:outputText value="#{item.distId}" />
</o:column>
</o:dataTable>
Any help or insight would be appreciated.
I apologize for answering my own question, but I figured out what I was doing wrong. When using customDataProver with filters, you need to define the expression attribute of the filter to be equal to the hibernate property you are trying to map to.
Changing
<o:dropDownFieldFilter condition="beginsWith" />
to
<o:dropDownFieldFilter condition="beginsWith" expression="distId" />
Made everything work just fine.
精彩评论