NullPointerException in QueryTranslatorImpl on erroneously typed delete query

Description

Calling code:

val deleteFileQuery = "delete from FileInstanceEntity f where f.uri = 'file:/blah.txt'"
em.getTransaction.begin()
val q = em.createQuery(deleteFileQuery, classOf[FileInstanceEntity]) // FYI classOf[Foo] is the Scala equivalent of Java's Foo.class –
// and it's the presence of this parameter that causes problems
q.executeUpdate()
em.getTransaction.commit()

Stack trace:
Exception in thread "main" java.lang.NullPointerException
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.getDynamicInstantiationResultType(QueryTranslatorImpl.java:571)
at org.hibernate.engine.query.spi.HQLQueryPlan.getDynamicInstantiationResultType(HQLQueryPlan.java:340)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:313)
at com.example.JpaEntityTest$.main(JpaEntityTest.scala:178)

Environment

Hibernate 4.1.1 (also affects 4.1.0), Postgresql

Assignee

Steve Ebersole

Reporter

Alex Cruise

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure