Good evening.
I would like to know if there is a way to do a JPQL query and set the entity at runtime, without having to concatenate or interpolate String.
Example using interpolation:
public long getRecords(String entity){
String q = String.format("COUNT(e) FROM %s e", entity);
Query query = em.createQuery(q);
return (long) query.getSingleResult();
}