Reputation: 25753
The following query that is working perfectly fine when I am using hibernate as the JPA provider is not working with OpenJPA:
entityManager.createQuery(
"select ord from Order ord " +
"where symbol = :symbol")
.setParameter("symbol", symbol)
.getResultList();
The error returned is
java.lang.IllegalArgumentException: Invalid unbound variable "symbol" in query
Am I doing something wrong in my query that OpenJPA does not like?
Upvotes: 0
Views: 780
Reputation: 556
I believe you want to change:"where symbol = :symbol" to :
"where ord.symbol = :symbol"
Or, use positional parameters:
"where ord.symbol = ?1"
.setParameter(1, symbol)
Hope that helps.
Upvotes: 2