Mapowanie encji : QuerySyntaxException: Comment is not mapped

0

Mam encję Comment

@Entity
@Table(name = "comments")
public class Comment {
// ...
}

CommentDaoImpl z metodą

@Override
    @Transactional
    public List<Comment> findAllPublishedByArticleId(int articleId) {
        return sessionFactory.getCurrentSession().createQuery("from Comment where articleId = :articleId")
                .setParameter("articleId", articleId).list();
    }

i do tego cfg Hibernate

<hibernate-configuration>
	<session-factory>
		<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
		<property name="show_sql">false</property>
		<mapping class="path.to.model.Comment" />
	</session-factory>
</hibernate-configuration>

Suma sumarum wywołuje mi to błąd:
HTTP Status 500 - Request processing failed; nested exception is org.hibernate.hql.internal.ast.QuerySyntaxException: Comment is not mapped [from Comment where articleId = :articleId]

Mapowanie Hbn niby mam, pole articleId w Comment istnieje i już nie wiem o co chodzi...

0

A skąð Hibernate ma się domyśleć co Ty chcesz pobrać ? Napisać selecta to nie łaska ? Matko kochana...

0

Zwróć uwagę czy dobre Entity zaimportowałeś. Bo jest javax i org.hibernate.

Drugą opcją jest zmiana kodu createQuery("from Comment where articleId = :articleId") na createQuery("from " + Comment.class.getName() + " where articleId = :articleId")

1 użytkowników online, w tym zalogowanych: 0, gości: 1