Spring Data JPA之投影查询

一、普通方式(五种)

参考链接:https://www.bytestree.com/spring/spring-data-jpa-projections-5-ways-return-custom-object/

二、Class-based Projections (DTOs)

除上述5种之外,还有一种Class-based Projections (DTOs),它无需像Argument Constructor方法那样使用JPQL,但是劣势是DTOs的属性为final类型。

参考链接:

https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#projections.dtos

https://www.baeldung.com/spring-data-jpa-projections 章节4

 

posted @ 2020-06-15 16:51  又是火星人  阅读(523)  评论(0编辑  收藏  举报