Hi all.
Im trying to use the simple filter mechanism of the JPA Criteria Lazy Container, but I got an error, and I dont know what im doing wrong.
Here is my code:
public CriteriaContainer<ItemConferenciaPreco> getItensConferenciaPreco(TarefaConferenciaPreco tarefa) {
TarefaConferenciaPrecoController controller = new TarefaConferenciaPrecoController();
CriteriaQueryDefinition<ItemConferenciaPreco> cd = new CriteriaQueryDefinition<ItemConferenciaPreco>(
controller.getDaoEntityManager(), true, 100, ItemConferenciaPreco.class);
CriteriaContainer<ItemConferenciaPreco> container = new CriteriaContainer<ItemConferenciaPreco>(cd);
LinkedList<FilterRestriction> filters = new LinkedList<FilterRestriction>();
filters.add(new FilterRestriction(ItemConferenciaPreco_.tarefa.getName(), FilterRestriction.Operation.EQ, tarefa));
container.filter(filters);
return container;
}
And the error:
Cause: javax.persistence.PersistenceException: Unknown property: tarefa
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:162)
at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1166)
at com.vaadin.ui.Button.fireClick(Button.java:380)
at com.vaadin.ui.Button.changeVariables(Button.java:196)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1297)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1217)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:733)
at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:483)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
Caused by: javax.persistence.PersistenceException: Unknown property: tarefa
at org.vaadin.addons.criteriacore.FilterRestriction.getPredicate(FilterRestriction.java:184)
at org.vaadin.addons.criteriacore.FilterRestriction.getConjoinedPredicate(FilterRestriction.java:210)
at org.vaadin.addons.beantuplecontainer.BeanTupleQueryDefinition.addFilteringConditions(BeanTupleQueryDefinition.java:577)
at org.vaadin.addons.beantuplecontainer.BeanTupleQueryDefinition.refresh(BeanTupleQueryDefinition.java:157)
at org.vaadin.addons.beantuplecontainer.BeanTupleQueryView.refresh(BeanTupleQueryView.java:233)
at org.vaadin.addons.lazyquerycontainer.LazyQueryContainer.refresh(LazyQueryContainer.java:374)
at org.vaadin.addons.beantuplecontainer.BeanTupleContainer.refresh(BeanTupleContainer.java:142)
at org.vaadin.addons.beantuplecontainer.BeanTupleContainer.filter(BeanTupleContainer.java:108)
at br.com.simus.supera.ciclonev2gui.models.tarefa.conferenciapreco.StatusTarefaConferenciaPrecoModel.getItensConferenciaPreco(StatusTarefaConferenciaPrecoModel.java:29)
at br.com.simus.supera.ciclonev2gui.views.tarefas.conferenciapreco.StatusTarefaConferenciaPreco.getItensComponent(StatusTarefaConferenciaPreco.java:130)
at br.com.simus.supera.ciclonev2gui.views.tarefas.conferenciapreco.StatusTarefaConferenciaPreco.<init>(StatusTarefaConferenciaPreco.java:57)
at br.com.simus.supera.ciclonev2gui.views.tarefas.conferenciapreco.ListaTarefaConferenciaPreco$2.buttonClick(ListaTarefaConferenciaPreco.java:91)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:490)
... 26 more
Caused by: javax.persistence.PersistenceException: Property tarefa cannot be mapped to a selection from the query.
at org.vaadin.addons.beantuplecontainer.BeanTupleQueryDefinition.getExpressionById(BeanTupleQueryDefinition.java:338)
at org.vaadin.addons.criteriacore.FilterRestriction.getPredicate(FilterRestriction.java:111)
... 42 more
Many thanks by atention!
Att,
Eduardo Frazao