Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PreparedStatement alternative within JPA?

Tags:

java

mysql

jpa

I am new to JPA, I used to used prepared statement in JDBC. Is there alternative to be used within JPA ? as there is a query which I call frequently

see this for info about prepared statment http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html

thanks in advance,,,

like image 604
mebada Avatar asked Feb 04 '23 05:02

mebada


1 Answers

The JPA way is EntityManager#createQuery() with named parameters in JPQL (examples in this chapter).

like image 93
BalusC Avatar answered Feb 05 '23 19:02

BalusC