meveo-org / meveo

meveo core
GNU Affero General Public License v3.0
10 stars 15 forks source link

Unable to sort CEI #701

Closed tonysviews closed 1 year ago

tonysviews commented 1 year ago

Describe the bug When trying to sort a column on any Custom Entity table, it results in an error and fails to sort.

To Reproduce Steps to reproduce the behavior:

  1. Login to meveo admin and go to any Custom Entity page.
  2. Click on any column to sort the custom entities by that column.
  3. Nothing happens on the frontend.
  4. In the backend, the following error is logged:
04:15:50,653 SEVERE [javax.enterprise.resource.webcontainer.jsf.context] (default task-2) javax.persistence.PersistenceException: Error with query: select a.uuid, "path", "size", lastUpdate, name, mimeType from {h-schema}unikbasedocument a  ORDER BY a.code ASC
params {}
org.hibernate.exception.SQLGrammarException: could not extract ResultSet
        at deployment.meveo.war//org.meveo.service.base.NativePersistenceService.list(NativePersistenceService.java:1489)
        at deployment.meveo.war//org.meveo.service.custom.CustomTableService.list(CustomTableService.java:738)
        at deployment.meveo.war//org.meveo.service.custom.CustomTableService$Proxy$_$$_WeldSubclass.list(Unknown Source)
        at deployment.meveo.war//org.meveo.persistence.impl.SQLStorageImpl.find(SQLStorageImpl.java:281)
        at deployment.meveo.war//org.meveo.persistence.CrossStorageService.find(CrossStorageService.java:389)
        at deployment.meveo.war//org.meveo.util.view.CrossStorageDataModel.load(CrossStorageDataModel.java:80)
        at deployment.meveo.war//org.primefaces.component.datatable.DataTable.loadLazyData(DataTable.java:573)
        at deployment.meveo.war//org.primefaces.component.datatable.feature.SortFeature.encode(SortFeature.java:107)
        at deployment.meveo.war//org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:88)
        at javax.faces.api@3.0.0.Final//javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
        at javax.faces.api@3.0.0.Final//javax.faces.component.UIComponent.encodeAll(UIComponent.java:1654)
        at com.sun.jsf-impl@2.3.9.SP04//com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:615)
        at com.sun.jsf-impl@2.3.9.SP04//com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:159)
        at deployment.meveo.war//org.primefaces.component.api.UIData.visitTree(UIData.java:874)
        at javax.faces.api@3.0.0.Final//javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
        at javax.faces.api@3.0.0.Final//javax.faces.component.UIForm.visitTree(UIForm.java:347)
        at javax.faces.api@3.0.0.Final//javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
        at javax.faces.api@3.0.0.Final//javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
        at javax.faces.api@3.0.0.Final//javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
        at javax.faces.api@3.0.0.Final//javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
        at com.sun.jsf-impl@2.3.9.SP04//com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:400)
        at com.sun.jsf-impl@2.3.9.SP04//com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:319)
        at deployment.meveo.war//org.primefaces.context.PrimePartialViewContext.processPartial(PrimePartialViewContext.java:63)
        at javax.faces.api@3.0.0.Final//javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:228)
        at deployment.meveo.war//org.omnifaces.context.OmniPartialViewContext.processPartial(OmniPartialViewContext.java:122)
        at javax.faces.api@3.0.0.Final//javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:1101)
        at javax.faces.api@3.0.0.Final//javax.faces.component.UIComponent.encodeAll(UIComponent.java:1647)
        at com.sun.jsf-impl@2.3.9.SP04//com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:442)
        at com.sun.jsf-impl@2.3.9.SP04//com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:170)
        at javax.faces.api@3.0.0.Final//javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
        at javax.faces.api@3.0.0.Final//javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
        at javax.faces.api@3.0.0.Final//javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
        at deployment.meveo.war//org.omnifaces.viewhandler.OmniViewHandler.renderView(OmniViewHandler.java:121)
        at javax.faces.api@3.0.0.Final//javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
        at javax.faces.api@3.0.0.Final//javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
        at com.sun.jsf-impl@2.3.9.SP04//com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:102)
        at com.sun.jsf-impl@2.3.9.SP04//com.sun.faces.lifecycle.Phase.doPhase(Phase.java:76)
        at com.sun.jsf-impl@2.3.9.SP04//com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:199)
        at javax.faces.api@3.0.0.Final//javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:708)
        at javax.faces.api@3.0.0.Final//javax.faces.webapp.FacesServlet.service(FacesServlet.java:451)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
        at io.undertow.websocket@2.0.27.Final//io.undertow.websockets.jsr.JsrWebSocketFilter.doFilter(JsrWebSocketFilter.java:173)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at io.opentracing.contrib.opentracing-jaxrs2//io.opentracing.contrib.jaxrs2.server.SpanFinishingFilter.doFilter(SpanFinishingFilter.java:52)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at deployment.meveo.war//org.meveo.admin.web.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:27)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at deployment.meveo.war//org.meveo.admin.web.filter.RedirectToStaleSessionFilter.doFilter(RedirectToStaleSessionFilter.java:57)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
        at org.wildfly.extension.undertow@18.0.1.Final//org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
        at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at org.keycloak.keycloak-undertow-adapter@10.0.2//org.keycloak.adapters.undertow.UndertowAuthenticatedActionsHandler.handleRequest(UndertowAuthenticatedActionsHandler.java:66)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
        at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.DisableCacheHandler.handleRequest(DisableCacheHandler.java:33)
        at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.core@2.0.27.Final//io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53)
        at io.undertow.core@2.0.27.Final//io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59)
        at io.undertow.core@2.0.27.Final//io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
        at io.undertow.core@2.0.27.Final//io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
        at io.undertow.core@2.0.27.Final//io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
        at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at org.wildfly.extension.undertow@18.0.1.Final//org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
        at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at org.wildfly.extension.undertow@18.0.1.Final//org.wildfly.extension.undertow.deployment.RewriteCorrectingHandlerWrappers$PostWrapper$1.handleRequest(RewriteCorrectingHandlerWrappers.java:71)
        at io.undertow.core@2.0.27.Final//io.undertow.predicate.PredicatesHandler.handleRequest(PredicatesHandler.java:110)
        at deployment.meveo.war//org.meveo.undertow.MaxPostSizeHandler.handleRequest(MaxPostSizeHandler.java:44)
        at io.undertow.core@2.0.27.Final//io.undertow.predicate.PredicatesHandler.handleRequest(PredicatesHandler.java:93)
        at org.wildfly.extension.undertow@18.0.1.Final//org.wildfly.extension.undertow.deployment.RewriteCorrectingHandlerWrappers$PreWrapper$1.handleRequest(RewriteCorrectingHandlerWrappers.java:52)
        at org.wildfly.extension.undertow@18.0.1.Final//org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
        at org.keycloak.keycloak-undertow-adapter@10.0.2//org.keycloak.adapters.undertow.ServletPreAuthActionsHandler.handleRequest(ServletPreAuthActionsHandler.java:69)
        at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:269)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:78)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:133)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:130)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
        at org.wildfly.extension.undertow@18.0.1.Final//org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
        at org.wildfly.extension.undertow@18.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504)
        at org.wildfly.extension.undertow@18.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504)
        at org.wildfly.extension.undertow@18.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504)
        at org.wildfly.extension.undertow@18.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504)
        at org.wildfly.extension.undertow@18.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:249)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:78)
        at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:99)
        at io.undertow.core@2.0.27.Final//io.undertow.server.Connectors.executeRootHandler(Connectors.java:376)
        at io.undertow.core@2.0.27.Final//io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
        at org.jboss.threads@2.3.3.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
        at org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
        at org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
        at org.hibernate@5.3.13.Final//org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
        at org.hibernate@5.3.13.Final//org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1515)
        at deployment.meveo.war//org.meveo.service.base.NativePersistenceService.list(NativePersistenceService.java:1484)
        ... 106 more
Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
        at org.hibernate@5.3.13.Final//org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:106)
        at org.hibernate@5.3.13.Final//org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
        at org.hibernate@5.3.13.Final//org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
        at org.hibernate@5.3.13.Final//org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
        at org.hibernate@5.3.13.Final//org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:69)
        at org.hibernate@5.3.13.Final//org.hibernate.loader.Loader.getResultSet(Loader.java:2265)
        at org.hibernate@5.3.13.Final//org.hibernate.loader.Loader.executeQueryStatement(Loader.java:2028)
        at org.hibernate@5.3.13.Final//org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1990)
        at org.hibernate@5.3.13.Final//org.hibernate.loader.Loader.doQuery(Loader.java:949)
        at org.hibernate@5.3.13.Final//org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:351)
        at org.hibernate@5.3.13.Final//org.hibernate.loader.Loader.doList(Loader.java:2787)
        at org.hibernate@5.3.13.Final//org.hibernate.loader.Loader.doList(Loader.java:2770)
        at org.hibernate@5.3.13.Final//org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2604)
        at org.hibernate@5.3.13.Final//org.hibernate.loader.Loader.list(Loader.java:2599)
        at org.hibernate@5.3.13.Final//org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:338)
        at org.hibernate@5.3.13.Final//org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:2254)
        at org.hibernate@5.3.13.Final//org.hibernate.internal.AbstractSharedSessionContract.list(AbstractSharedSessionContract.java:1069)
        at org.hibernate@5.3.13.Final//org.hibernate.query.internal.NativeQueryImpl.doList(NativeQueryImpl.java:170)
        at org.hibernate@5.3.13.Final//org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1506)
        ... 107 more
Caused by: org.postgresql.util.PSQLException: ERROR: column a.code does not exist
  Position: 93
        at org.postgresql@42.2.5//org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
        at org.postgresql@42.2.5//org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
        at org.postgresql@42.2.5//org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
        at org.postgresql@42.2.5//org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
        at org.postgresql@42.2.5//org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
        at org.postgresql@42.2.5//org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:143)
        at org.postgresql@42.2.5//org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:106)
        at org.jboss.ironjacamar.jdbcadapters@1.4.17.Final//org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:504)
        at org.hibernate@5.3.13.Final//org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:60)
        ... 121 more

Expected behavior The custom entities should be sorted according to the chosen table and will reverse order when clicked again.