What is the right way do validate a jpa query programmatically. Hibernate validates all annotation based named queries on entities. But how can I call this validation routine on programmatically builded jpa queries, to check for errors?
@Entity public class Foo { @Id public int id; public String name; }
main(...) { Query q = getEntityManager().createQuery("select e from " + Foo.class.getName() + " e where e.name = 'x' "); // validate q here }