I have written a namedQuery in my Entity class as @NamedQuery(name="Place.findByPlaceCode", query="select p from Place p where p.Code = :placeCode")
I execute the named query with the following :
List<Country> result = getEntityManager()
.createNamedQuery("Place.findByPlaceCode")
.setParameter("placeCode", placeCode)
.getResultList();
return processResult(result);
However, it is returning nothing .
If I write an SQL query in the database it runs fine but this namedQuery is not working. I tried setting the parameter manually to the value "Beach" and also tried "Beach " to check if it was the whitespaces causing the issue but it did'nt make any difference. How should I check the values returned by this query ?