Table Column Sort over paginated results

Hi,

I’m noticing that when I sort on a MetaProperty column over a result set that is paginated, it doesn’t sort across all the rows in the table. Am I missing something or is this expected behaviour?

Example Entity

public Date getSampleDate() {
  // where dummyEntities is a List defined on this entity
  for (DummyEntity d : getDummyEntities() {
    // simply return the date of the first entry
    return d.getDummyDate();
  }
}

Thanks for your help.

Regards,
Eddy

Hi Eddy,

It is documented here:

If the column refers to a non-persistent entity attribute, the database sorting will be performed by attributes defined in the related() parameter of the @MetaProperty annotation. If no related attributes are specified, the sorting will be performed in memory only within the current page.

Regards,
Konstantin

Hi Konstantin,

I have tried that but can’t seem to get it to work correctly. I’m trying to map it to a List which has an order by set to its createTs field, and within the getter, I perform some additional filtering.

The sorting seems to be happening in a way that I can’t make sense of, meaning its not being sorted within the current page nor the entire table; would appreciate any further suggestions.

For example:

@Temporal(TemporalType.DATE)
@MetaProperty(related = "listAttribute")
public Date getSampleDate() {
    if (listAttribute.getSomeOtherField()=="value") {
        return listAttribute.getCreateTs();
    }
}

Thanks!

Hi Eddy
Sorting by related attribute now works only if the related attribute is mapped to a table column. If your listAttribute is a collection, it’s impossible.
We’ll consider your use case when implementing this issue.