PålOliver
PålOliver

Reputation: 2660

Hibernate - Session.createQuery(String) returns null after upgrade

Upgraded an old application running Tapestry v5.4.5 -> v5.8.2, we get issues with Hibernate/HQL queries.

A query like this that used to work

session.createQuery("from MyEntity", MyEntity.class)

Is now throwing exception: java.lang.NullPointerException: Cannot invoke "org.hibernate.query.Query.list()" because the return value of "org.hibernate.Session.createQuery(String, java.lang.Class)" is null

All our Hibernate is in the hibernate.cfg.xml

Anyone know why this happens?

As a fun fact, using a EntityManager seems to work fine though:

session.getEntityManagerFactory()
                .createEntityManager()
                .createQuery("select e from MyEntity e", MyEntity.class)
                .getResultList()
    

Upvotes: 0

Views: 603

Answers (0)

Related Questions