I do understand the advantages of prepared statments over dynamic sql as described in Difference between Statement and PreparedStatement.
However I'm not sure how to tell JPA to (not) use a prepared statement.
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?
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: