如何告诉JPA使用准备好的语句(或动态sql)?

编程入门 行业动态 更新时间:2024-10-11 21:32:07
本文介绍了如何告诉JPA使用准备好的语句(或动态sql)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我确实了解如语句与PreparedStatement之间的区别所述,预备语句比动态sql的优势.

但是我不确定如何告诉JPA(不)使用准备好的语句.

However I'm not sure how to tell JPA to (not) use a prepared statement.

我有许多命名查询. JPA是否为此自动使用准备好的语句?标准API呢?我的猜测是它正在使用动态SQL?

I have a number of named queries. Is JPA automatically using prepared statments for this? What about criteria API. My guess is that it's using dynamic sql?

推荐答案

我同意Michele的观点,即通常 准备好的语句由底层的JPA提供程序/实现者使用.为了确保您的语句已经准备好并且使用标准JPA缓存了结果(您希望这样做),请在此处查看我的回复:

I concur with Michele in that generally prepared statements are used by the underlying JPA provider/implementer. To assure that your statements are prepared and results cached (should you desire this) using standard JPA please see my response here:

如何有效使用PreparedStatement?

更多推荐

如何告诉JPA使用准备好的语句(或动态sql)?

本文发布于:2023-07-21 06:01:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1174825.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:语句   动态   JPA   sql

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!