I'm having an entity embedded into another as shown below.
The repository is created on the DepEntity.
I am trying retrieve the DepEntity objects sorted on totalExp column
in ExpEntity.
I m making a GET call using Pageable and getting the error:
2018-12-18 05:17:58.172 WARN 7 --- [http-nio-8000-exec-3] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.data.mapping.PropertyReferenceException: No property totalExp found for type DepEntity!]
I tried with totalExp, exp.totalExp and exp_totalExp and none of them worked. The spring data jpa version is 2.1.1
@Entity
public class DepEntity {
@Embedded
private ExpEntity exp;
}
@Embeddable
public class ExpEntity {
@Column(name = "exp_total")
private BigDecimal totalExp;
}
I expect the results in sorted order on the nested property totalExp.
Is there a way to achieve this?