Skip to content

Spring Data JDBC - Sort.by does not work on nested @Embedded property #1758

@aveilleux

Description

@aveilleux

Hi,

Similar to this old issue #1286, I have another use case that doesn't seem to work for a nested @Embedded sort.

To summarize the use case with an example:

@Entity
class MyTable(
    @OneToOne
    MyTableDetails tableDetails;
    .....
)
@Entity
class MyTableDetails(
    @Embedded
    MoreEmbeddedDEtails moreDetails;
   ....
)
@Embeddable
class MoreEmbeddedDEtails(
    string simpleDetail
)

So when I try to sort on my MyTable, it looks like Sort.by("tableDetails.moreDetails.simpleDetail").ascending(), but I got an error similar to this one:

Caused by: java.lang.IllegalArgumentException: Unable to locate Attribute with the the given name [moreDetails.simpleDetail] on this ManagedType [MyTableDetails]

Currently using version spring-data-commons-2.7.18.

Thanks

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions