Table sort Exception

Hello, we are trying to use soft-references addon. In our problem there are 3 entittes:

 @Table(name = "FIRST")
 @Entity(name = "test_First")
 @NamePattern("%s %s|requestNum,requestDate")
 class First extends StandardEntity {
       @Column(name = "REQUEST_NUM", nullable = false, unique = true)
       @NotNull
       private Long requestNum;
   
      @Temporal(TemporalType.DATE)
      @NotNull
      @Column(name = "REQUEST_DATE", nullable = false)
      private Date requestDate;
   
      // getter and setter
 }


 @Table(name = "SECOND")
 @Entity(name = "test_Second ")
 @NamePattern("%s|name")
 class Second extends StandardEntity {
    @NotNull
    @Column(name = "NAME", nullable = false, length = 512)
    protected String name;
   
    // getter and setter
 }

And 3d entity witch refersTo first and second entity

@NotNull
@MetaProperty(datatype = "EntitySoftReference")
@Column(name = "REFERS_TO", nullable = false)
@Convert(converter = EntitySoftReferenceConverter.class)
protected com.haulmont.cuba.core.entity.Entity refersTo;

When we have a table with 3d entity and one of columns is refersTo. if we try to sort table by refersTo there will be:

java.lang.IllegalArgumentException: Can't find getter for property 'requestNum' at class com.test.entity.Second 
	at com.haulmont.chile.core.model.utils.MethodsCache.getGetterNN(MethodsCache.java:155) ~[cuba-global-7.2.14.jar:7.2.14]
	at com.haulmont.chile.core.model.impl.AbstractInstance.getValue(AbstractInstance.java:107) ~[cuba-global-7.2.14.jar:7.2.14]
	at com.haulmont.cuba.core.entity.BaseGenericIdEntity.getValue(BaseGenericIdEntity.java:146) ~[cuba-global-7.2.14.jar:7.2.14]
	at com.haulmont.cuba.gui.data.impl.AbstractComparator.compareAsc(AbstractComparator.java:65) ~[cuba-gui-7.2.14.jar:7.2.14]
	at com.haulmont.cuba.gui.data.impl.AbstractComparator.__compare(AbstractComparator.java:46) ~[cuba-gui-7.2.14.jar:7.2.14]
	at com.haulmont.cuba.gui.model.impl.EntityValuesComparator.compare(EntityValuesComparator.java:46) ~[cuba-gui-7.2.14.jar:7.2.14]
	at java.base/java.util.Comparator.lambda$comparing$ea9a8b3a$1(Comparator.java:436) ~[na:na]
	at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:360) ~[na:na]
	at java.base/java.util.TimSort.sort(TimSort.java:234) ~[na:na]
	at java.base/java.util.Arrays.sort(Arrays.java:1515) ~[na:na]
	at java.base/java.util.ArrayList.sort(ArrayList.java:1750) ~[na:na]
	at com.haulmont.cuba.gui.model.impl.BaseContainerSorter.sortInMemory(BaseContainerSorter.java:57) ~[cuba-gui-7.2.14.jar:7.2.14]
	at com.haulmont.cuba.gui.model.impl.CollectionContainerSorter.sort(CollectionContainerSorter.java:52) ~[cuba-gui-7.2.14.jar:7.2.14]
	at com.haulmont.cuba.gui.components.data.table.ContainerTableItems.sort(ContainerTableItems.java:249) ~[cuba-gui-7.2.14.jar:7.2.14]
	at com.haulmont.cuba.web.gui.components.table.SortableDataContainer.sort(SortableDataContainer.java:35) ~[cuba-web-7.2.14.jar:7.2.14]
	at com.vaadin.v7.ui.Table.sort(Table.java:4831) ~[vaadin-compatibility-server-8.9.2-26-cuba.jar:8.9.2-26-cuba]
	at com.vaadin.v7.ui.Table.sort(Table.java:4866) ~[vaadin-compatibility-server-8.9.2-26-cuba.jar:8.9.2-26-cuba]
	at com.vaadin.v7.ui.Table.changeVariables(Table.java:3041) ~[vaadin-compatibility-server-8.9.2-26-cuba.jar:8.9.2-26-cuba]
	at com.haulmont.cuba.web.widgets.CubaTable.changeVariables(CubaTable.java:367) ~[cuba-web-widgets-7.2.14.jar:na]
	at com.vaadin.server.communication.ServerRpcHandler.changeVariables(ServerRpcHandler.java:611) ~[vaadin-server-8.9.2-26-cuba.jar:8.9.2-26-cuba]
	at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:457) ~[vaadin-server-8.9.2-26-cuba.jar:8.9.2-26-cuba]
	at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:400) ~[vaadin-server-8.9.2-26-cuba.jar:8.9.2-26-cuba]
	at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:260) ~[vaadin-server-8.9.2-26-cuba.jar:8.9.2-26-cuba]
	at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:82) ~[vaadin-server-8.9.2-26-cuba.jar:8.9.2-26-cuba]
	at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) ~[vaadin-server-8.9.2-26-cuba.jar:8.9.2-26-cuba]
	at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1580) ~[vaadin-server-8.9.2-26-cuba.jar:8.9.2-26-cuba]
	at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:425) ~[vaadin-server-8.9.2-26-cuba.jar:8.9.2-26-cuba]
	at com.haulmont.cuba.web.sys.CubaApplicationServlet.serviceAppRequest(CubaApplicationServlet.java:329) ~[cuba-web-7.2.14.jar:7.2.14]
	at com.haulmont.cuba.web.sys.CubaApplicationServlet.service(CubaApplicationServlet.java:215) ~[cuba-web-7.2.14.jar:7.2.14]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[servlet-api.jar:4.0.FR]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[catalina.jar:9.0.38]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.38]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-websocket.jar:9.0.38]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:9.0.38]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.38]
	at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:108) ~[spring-web-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.web.filter.CompositeFilter.doFilter(CompositeFilter.java:74) ~[spring-web-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at com.haulmont.cuba.web.sys.CubaHttpFilter.doFilter(CubaHttpFilter.java:93) ~[cuba-web-7.2.14.jar:7.2.14]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:9.0.38]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.38]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[catalina.jar:9.0.38]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[catalina.jar:9.0.38]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) ~[catalina.jar:9.0.38]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) ~[catalina.jar:9.0.38]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[catalina.jar:9.0.38]
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690) ~[catalina.jar:9.0.38]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[catalina.jar:9.0.38]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[catalina.jar:9.0.38]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) ~[tomcat-coyote.jar:9.0.38]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-coyote.jar:9.0.38]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) ~[tomcat-coyote.jar:9.0.38]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) ~[tomcat-coyote.jar:9.0.38]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-coyote.jar:9.0.38]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-util.jar:9.0.38]
	at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

And sometimes same Exception but: java.lang.IllegalArgumentException: Can't find getter for property 'name' at class com.test.entity.First

Is it possible to fix it somehow?

Hi,
Built-in CUBA Table behavior is to apply column sorting to the JPQL query used in the collection container - add “order by columnName” clause to the query string.
With soft-reference table column - sorting by the database column isn’t possible.

Possible solutions:

  1. Set sortable = false to this column.
  2. Implement custom collectionContainer sorter. Information is available here: Custom Sorting - CUBA Platform. Developer’s Manual