0

I am trying to get list of data sorted by a property "created_at" by using the following method. But the Sort.by() method is not able to read the property name , it is only reading "created" not "created_at".

    public List<Invoice> getAllInvoices() {
    return repo.findAll(Sort.by("created_at").descending());    
}

Below is the console message:

org.springframework.data.mapping.PropertyReferenceException: No property created found for type Invoice!

enter image description here

prax
  • 286
  • 3
  • 10

1 Answers1

1

This could be the issue in your case as well: I ran into this same issue and found the solution here: https://dzone.com/articles/persistence-layer-spring-data

I had renamed an entity property. But with Springs Automatic Custom Queries there was an interface defined for the old property name. https://stackoverflow.com/a/26539097/10832295

Aziz Gasimov
  • 66
  • 3
  • 13