spring Data jpa 一对多关联 动态查询怎么写
发布网友
发布时间:2022-05-21 14:14
我来回答
共1个回答
热心网友
时间:2024-03-05 19:15
predicates.add(cb.like(root.get("commodityBarcodes").get("barCode"), "%" + dto.getBarCode() + "%"));
你试试这样写,我用@OneToOne就是这么写的。感觉这样也差不多
追问我是@OneToMany
像你这样写会报错
Illegal attempt to dereference path source [null.commodityBarcodes] of basic type; nested exception is java.lang.IllegalStateException: Illegal attempt to dereference path source [null.commodityBarcodes] of basic type