Olá,
Estou tentando fazer a seguinte query JPQL:
String jpql = "SELECT u FROM Users u WHERE u.username=?;";
Query query = getEntityManager().createQuery(jpql);
query.setParameter(1, username);
Estou tendo a seguinte exception:
line 1:40 mismatched character ';' expecting set '1'..'9'
org.springframework.dao.InvalidDataAccessApiUsageException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [SELECT u FROM Users u WHERE u.username=?;], line 0, column -1: unexpected end of query.
Internal Exception: NoViableAltException(-1!=[797:1: comparisonExpressionRightOperand returns [Object node] : (n= arithmeticExpression | n= nonArithmeticScalarExpression | n= anyOrAllExpression );]); nested exception is java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [SELECT u FROM Users u WHERE u.username=?;], line 0, column -1: unexpected end of query.
Internal Exception: NoViableAltException(-1!=[797:1: comparisonExpressionRightOperand returns [Object node] : (n= arithmeticExpression | n= nonArithmeticScalarExpression | n= anyOrAllExpression );])
...
Caused by: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [SELECT u FROM Users u WHERE u.username=?;], line 0, column -1: unexpected end of query.
Internal Exception: NoViableAltException(-1!=[797:1: comparisonExpressionRightOperand returns [Object node] : (n= arithmeticExpression | n= nonArithmeticScalarExpression | n= anyOrAllExpression );])
...
Caused by: Exception [EclipseLink-8028] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Syntax error parsing the query [SELECT u FROM Users u WHERE u.username=?;], line 0, column -1: unexpected end of query.
Internal Exception: NoViableAltException(-1!=[797:1: comparisonExpressionRightOperand returns [Object node] : (n= arithmeticExpression | n= nonArithmeticScalarExpression | n= anyOrAllExpression );])
Alguém poderi ajudar?