I learned that when I want to paging '@Embedded class's properties', I have to write down the code like
@Entity
public class DepEntity {
@Embedded
private ExpEntity exp;
}
@Embeddable
public class ExpEntity {
@Column(name = "exp_total")
private BigDecimal totalExp;
}
Sort sort = Sort.by("exp.totalExp").descending();
PageRequest pageRequest = PageRequest.of(0, 10, sort);
Page<DepEntity> depEntities = depEntityRepository.findAll(pageRequest);
just like Sort.by("exp.totalExp").descending()
, when I want to paging 'totalExp' property, I have to use it as 'exp.totalExp'.
My question is, how does spring know that totalExp is in ExpEntity? Does spring do string check? if so, where can I see that code?
I'm sorry about my bad english