Again, posting and answering a question for the benefit of others based on a problem I had the other day. Hopefully this saves someone a bit of time. I was a little surprised this wasn’t built into JPA’s EntityManager.
How can I determine if an Entity has a NamedQuery annotation with a specific name?
I need to determine if an Entity has a particular @NamedQuery before I try executing it.
When annotations are nested, you can get the properties of the annotation to get it’s children. In the case of
@NamedQueries, it’s.value().