Victor
Victor

Reputation: 17077

JPA named queries

I have a java class that implements serializable and the class begins with :

@NamedQueries( {
@NamedQuery(....)
@NamedQuery(....)
...
..})

My question is at what stage these queries are going to be executed because i see no direct call to these queries by their name Project is using JPA. I think IBM implementation of JPA...surely not hibernate.

Thank you

Upvotes: 0

Views: 1395

Answers (1)

Augusto
Augusto

Reputation: 29837

Each named query has a name and the query is executed by invoking EntityManager.createnamedQuery().

If the name of the query is based on a constant, you can search the usages of the constant in your project or if it's just a string, you can a text search in your project.

If you don't find any usages, there's a chance that those queries are not used at all, unless there's another framework that is invoking them (by doing something like convention over configuration).

Upvotes: 3

Related Questions