Preferred alternative in JPA?

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,,

+6
java mysql jpa
source share
3 answers

JPA EntityManager#createQuery() path with named parameters in JPQL (examples in this chapter ).

+7
source share

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).

See Creating Queries Using the Java Save Query Language in Java eE 6 Examples for examples.

+3
source share

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?

0
source share

All Articles