0

I have a query in hibernate to get list of items as below:

public List<ToDo> getItemsWithStatus(String status) {
    TypedQuery<ToDo> query = em.createQuery(
            "SELECT u FROM TODO u WHERE u.status LIKE :status ORDER BY u.id", ToDo.class);
    return query.getResultList();
}

But while executing the method, I'm getting this exception:

org.hibernate.hql.internal.ast.QuerySyntaxException: TODO is not mapped [SELECT u FROM TODO u WHERE u.status LIKE :status ORDER BY u.id]

Thanks Jithesh

1 Answer 1

4

Your entity class is named ToDo, but in your JPQL you are using TODO (notice the difference in cases).

Sign up to request clarification or add additional context in comments.

2 Comments

I have updated the JPQL, and successfully created the query object. But while executing the query getting the below exception org.hibernate.QueryException: Not all named parameters have been set: [status] [SELECT u FROM ToDo u WHERE u.status LIKE :status ORDER BY u.id]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.