String query = "select t from myTable t where t.idOne = " + myId
+ " AND t.idTwo = " + myIdTwo
+ " AND t.idThree = " + myIdThree
+ "AND t.idFour = (select max(t.idFour) from t)";
So myTable has a column where I need to get the MAX id from and use it in the query.
The last line gives me an error:
Error while running query: An exception occurred while creating a query in EntityManager:
java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: Exception Description: Syntax error parsing [query from above]. [214, 214] An identification variable must be provided for a range variable declaration.