Can not create specification that will check class of field

runelife

New Member
Entity Order contains field:\[code\]@ManyToOne(optional = false)private AbstractRequester requester;\[/code\]I wanna get data by type this field. I created specification like in documentation, but on\[code\]page = orderRepository.findAll(spec, pageable);\[/code\]get Exceptionorg.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.QueryException: could not resolve property: class of: ...order.OrderMy specs:\[code\]@Override\[/code\]\[code\]public Predicate toPredicate(Root<Order> root, CriteriaQuery<?> query, CriteriaBuilder cb) {Predicate megaPredicate = cb.conjunction();\[/code\]...\[code\]megaPredicate = cb.and(megaPredicate, cb.and( cb.equal(root.get("requester").type(), cb.literal(PersonRequester.class))\[/code\]...\[code\]return megaPredicate;}\[/code\]
 
Back
Top