I created a simple session bean and find method works fine. Problem comes with queries...I tried to make this simple query:
Query query = em.createQuery("from Employee e where e.name='myName' ")
but I get this exception:
GRAVE: [!!EXCEPTION!!] An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [from Employee e where e.name='myName'], line 1, column 0: unexpected token [from].
Internal Exception: NoViableAltException(33@)
and this goes for every query I make...I tried different others but result is always the same...
in HQL you can drop the "select" clause, but i don't think you can do that in the JPA query language. did you try something like "select e from Employee e where e.name='myName'"?
More examples here http://docs.oracle.com/javaee/5/tutorial/doc/bnbtg.html .
Edited by: jtahlborn on Apr 13, 2012 1:01 PM