如何告诉JPA使用准备好的语句(或动态sql)? [英] How can I tell JPA to use prepared statements (or dynamic 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:
这篇关于如何告诉JPA使用准备好的语句(或动态sql)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!