I am getting the following error when I try to run a query using EntityManager:
Exception in thread "main" java.lang.reflect.InvocationTargetException
Caused by: java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: * near line 1, column 8
What could be causing this?
Code:
public static void main(String [] args) {
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("myClass");
EntityManager em = entityManagerFactory.createEntityManager();
List<String> results= em.createQuery(
"SELECT * FROM myClass ")
.setMaxResults(10)
.getResultList();
}