I have the following query used for the bidInviteDc defined in the screen:
select e from erp$BidInvite e where e.company = :company
In the controller, I have passed the following parameter -
@Subscribe
private void onBeforeShow(BeforeShowEvent event) {
loadDataContainerData();
}
private void loadDataContainerData(){
if (getEditedEntity().getCompany() != null) {
getEditedEntity().setCompany(userSessionSource.getUserSession().getAttribute("defaultCompany"));
}
bidInvitesLc.setParameter("company", getEditedEntity().getCompany());
getScreenData().loadAll();
}
I am getting the following exception when I run it"
java.lang.IllegalStateException: Query argument company not found in the list of parameters provided during query execution.
at org.eclipse.persistence.internal.jpa.QueryImpl.processParameters(QueryImpl.java:592)
at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:183)
at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:482)
at com.haulmont.cuba.core.sys.QueryImpl.getResultFromCache(QueryImpl.java:715)
at com.haulmont.cuba.core.sys.QueryImpl.getResultList(QueryImpl.java:372)
at com.haulmont.cuba.core.app.RdbmsStore.executeQuery(RdbmsStore.java:756)
at com.haulmont.cuba.core.app.RdbmsStore.getResultList(RdbmsStore.java:664)
at com.haulmont.cuba.core.app.RdbmsStore.loadList(RdbmsStore.java:225)
at com.haulmont.cuba.core.app.DataManagerBean.loadList(DataManagerBean.java:74)
at com.haulmont.cuba.core.app.DataServiceBean.loadList(DataServiceBean.java:54)
at sun.reflect.GeneratedMethodAccessor370.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
at com.haulmont.cuba.core.sys.ServiceInterceptor.aroundInvoke(ServiceInterceptor.java:117)
at sun.reflect.GeneratedMethodAccessor349.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy138.loadList(Unknown Source)
at sun.reflect.GeneratedMethodAccessor369.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.haulmont.cuba.core.sys.remoting.LocalServiceInvokerImpl.invoke(LocalServiceInvokerImpl.java:94)
at com.haulmont.cuba.web.sys.remoting.LocalServiceProxy$LocalServiceInvocationHandler.invoke(LocalServiceProxy.java:154)
at com.sun.proxy.$Proxy340.loadList(Unknown Source)
at com.haulmont.cuba.client.sys.DataManagerClientImpl.loadList(DataManagerClientImpl.java:57)
at com.haulmont.cuba.gui.model.impl.CollectionLoaderImpl.load(CollectionLoaderImpl.java:88)
at com.haulmont.cuba.gui.model.impl.ScreenDataImpl.loadAll(ScreenDataImpl.java:79)
at com.myapp.web.proc.purchaserequisition.PurchaseRequisitionEdit.loadDataContainerData(PurchaseRequisitionEdit.java:396)
at com.myapp.web.proc.purchaserequisition.PurchaseRequisitionEdit.onBeforeShow(PurchaseRequisitionEdit.java:107)
at com.haulmont.bali.events.EventHub.publish(EventHub.java:170)
at com.haulmont.cuba.gui.screen.Screen.fireEvent(Screen.java:128)
at com.haulmont.cuba.gui.screen.UiControllerUtils.fireEvent(UiControllerUtils.java:58)
at com.haulmont.cuba.web.sys.WebScreens.show(WebScreens.java:422)
at com.haulmont.cuba.gui.screen.Screen.show(Screen.java:309)
at com.haulmont.cuba.gui.actions.list.EditAction.actionPerform(EditAction.java:144)
at com.haulmont.cuba.web.gui.components.WebButton.buttonClicked(WebButton.java:62)
at com.haulmont.cuba.web.widgets.CubaButton.fireClick(CubaButton.java:76)
It seems that the query is running before I have passed the parameter. Thanks for sharing the correct process.