首页 > 其他 > 详细

Jpa创建筛选器自动忽略nul值进行搜索

时间:2020-07-28 01:33:59      阅读:111      评论:0      收藏:0      [点我收藏+]

Jpa创建筛选器自动忽略nul值进行搜索

//创建一个筛选器
ExampleMatcher exampleMatcher = ExampleMatcher.matching().withMatcher("code", ExampleMatcher.GenericPropertyMatchers.contains().startsWith()).withIgnoreNullValues().withMatcher("name", ExampleMatcher.GenericPropertyMatchers.contains());
Person person=new Person();
person.setCode(code);
person.setName(name);
Example<Person> example=Example.of(person,exampleMatcher);
List<Person> personList=personRepository.findAll(example);

Jpa创建筛选器自动忽略nul值进行搜索

原文:https://www.cnblogs.com/JaminYe/p/13388015.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!