java I在QueryDSL中有没有一种通过示例找到的方法?
是否可以使用示例实体生成QueryDSL谓词?例如:
Customer customerExample = new Customer();
customerExample.setName("John");
customerExample.setCountry("EUA");
QCustomer customer = QCustomer.customer;
Customer bob = queryFactory.selectFrom(customer)
.where(customer.example(customerExample )) // matches customers with name like "John" and country like "EUA"
.fetch();
如果没有,除了使用SpringJPA还有其他选择吗
# 1 楼答案
你可以试试
此外,它将返回
List<Tuple>
,而不是“Customer”。因此,之后您必须将结果映射到“客户”