I think your query should be ...
[CDATA[SELECT OBJECT(u) FROM Users u WHERE u.usertype = ?1]]
with u.usetype in lowercase letters (because I suppose usertype is the field name and is in lowercases)
Due ?1 is a java.lang.String I don't know if you need to put ?1 between '?1'
If putting usertype in lowercase does not work try the latter.
Let me know if if helped you.
My column name is UserType.
But Changing from u.USERTYPE to u.usertype solved the problem.
I never doubted it cause "sql statements are supposed to be non case sensitive".
Tried the 2nd option too. It didn't throw any exceptions But didn't fetch any results. Maybe because it isn't a well formed
Thanx a lot
The terminal name refers to the name as per the abstract getter / setter convensions, ie remove the [gs]et. While SQL is not case sensitive, EJB-QL is not SQL, and is case sensitive in some parts. You will find the same on schema name also I think.
Re the = ?1 vs '?1', the second form will return no rows because it will be looking for rows where the usertype column has the literal value "?1", ie it's treating it as a literal rather than a variable.