概述
I use spring data and the JpaSpecificationExecutor::findAll method to fetch my models. How I could use query hints when calling this method?
The above source code works fine but I can't set QueryHint for my JPA provider (in my case EclipseLink).
@Repository
public interface ProductRepository extends JpaRepository, JpaSpecificationExecutor {
}
@Service
public class ProductService {
@Autowired
private ProductRepository productRepository;
public List findByTitle(String locale, String titleToSearch) {
return productRepository.findAll((Root root, CriteriaQuery> query, CriteriaBuilder builder) -> {
return builder.equal(builder.function("jsonb_extract_path_text", String.class, root.get("title"), builder.literal(locale)), titleToSearch);
}
最后
以上就是感性冬天为你收集整理的Java @queryhint,使用JpaSpecificationExecutor时使用QueryHint的全部内容,希望文章能够帮你解决Java @queryhint,使用JpaSpecificationExecutor时使用QueryHint所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复