Home > OS >  The function findall(Sorty.by("created_at").descending()) not able to read the property
The function findall(Sorty.by("created_at").descending()) not able to read the property

Time:12-25

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

CodePudding user response:

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

  • Related