I'm trying to populate a tsp page based on what parameter was passed to it. Currently I'm using the title of the blog post, I don't like this but I wanted proof of concept and had difficulties obtaining the object id. So, I'm temporarily passing in the title string with a view to change it later.
My query is throwing a too few arguments exception, none of the examples I've come across have lead me to believe that there is something missing so I'm slightly confused. The call is:
@Transactional
public objectName getObjectByTitle(String title){
TypedQuery< objectName > query = em.createQuery(
"SELECT b FROM tableName AS b WHERE b.title = :title",
objectName.class);
return query.getSingleResult();
}
with the error being:
com.objectdb.o._PersistenceException: Attempt to execute a query with too few arguments
It might be one of those cases where I'm looking too hard but I've scoured the objected site and cannot find a solution. Any help is appreciated.
You defined a named parameter in the query, and didn't bother setting its value (using setParameter), even though you went to the trouble of passing "title" in to the method ...