![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Spring Boot Jpa
辉呀
哥撸的不是码,是寂寞。
展开
-
ExampleMatcher 针对不同字段实现不同方式查询
在使用ExampleMatcher时,有时候会碰到,查询时不同字段的查询方式不同,例如,想要对姓名实现前后模糊查询,同时对学号精确查询时。示范代码:Student student = new Student() ;student.setStudentName(studentName);student.setStudentCode(studentCode);ExampleMatcher exampleMatcher = ExampleMatcher.matching() //对name前后模糊查原创 2021-04-12 11:15:25 · 3416 阅读 · 1 评论 -
Spring Jpa 自动根据实体类生成资源类
hibernate-jpamodelgen提供了一个方便获取实体类属性名的方法,当数据库或实体类的属性名改变后,不用去变动其他层代码。原创 2021-03-31 11:59:44 · 308 阅读 · 0 评论 -
SpringBoot Jpa模糊查询+分页
SpringBoot Jpa模糊查询+分页在使用Jpa框架开发时遇到模糊查询还需要分页时,发现ExampleMatcher可以完成此功能的开发。第一、建立实体类其中的注解除了@Data、@Entity、@Table(name = "student")必填,其他视情况添加@Builder@Data@Entity@NoArgsConstructor@AllArgsConstructor@SuppressWarnings("unused")@Table(name = "student")原创 2021-04-09 11:55:15 · 1978 阅读 · 0 评论