Yesterday I came across the following error message while testing a JPQL named query
An alias is required for the schema name MyEntity in the expression…
A quick Yahoo! search only returned me something like this which isn’t very useful. Anyway, the solution was extremely simple: my name query was incorrect. Instead of writing
select ent from MyEntity ent where ent.status.code = : code
I had written
select ent from MyEntity where ent.status.code = :code
Because I had forgotten to declare the variable ‘ent’ I suppose OpenJPA expected it to be a schema name or something.