I am new to JPA, I used the used statement in JDBC. Is there an alternative for use in JPA? as there is a request that I often call
see this for prepared status information http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html
thanks in advance,,
JPA EntityManager#createQuery() path with named parameters in JPQL (examples in this chapter ).
EntityManager#createQuery()
The Java Persistence API provides query APIs for creating dynamic queries and named queries. The Query method setParameter associates an argument with a parameter (both named queries and dynamic queries can use named parameters, as well as positional parameters, you simply cannot mix both types of parameters).
setParameter
See Creating Queries Using the Java Save Query Language in Java eE 6 Examples for examples.
What are you trying to achieve? =)
If you have a statement that you use quite often, would that be a good reason to put it in a method in a bean / DAO session?