Answer the question
In order to leave comments, you need to log in
HQL Hibernate how to write correctly?
Hello! Who is familiar with HQL in hibernet? How to write this question correctly? Rolled from a book but it's not clear why it doesn't work?
Error:
"Can't resolve symbol persons" "Exception in thread "main"
org.hibernate.hql.internal.ast.QuerySyntaxException
: persons is not mapped [from persons p where p.name = :name ]""
IDEA, there are settings for Facets under hibernate!Despite this, I get compilation errors!
public static Person findPerson(Session session , String name){
String makeQuery = "from persons p where p.name = :name "; // Тут выдаёт ошибку компиляции на persons! Почему ?
Query query = session.createQuery(makeQuery);
query.setParameter("name",name);
return (Person) query.uniqueResult();
}
Answer the question
In order to leave comments, you need to log in
Entity name, capitalized and singular, exactly as the class is named: "from P erson ̶s̶ p where p.name = :name"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question