This line throws a NPE rooted in `SessionFactoryImpl#getReturnTypes` method:

```
    Query q = em.createQuery("DELETE FROM Table t WHERE row = :row"), Table.class);

```

To be more specific the method returning the null value is `HQLQueryPlan#getReturnMetadata()`, that's why this instruction in `SessionFactoryImpl#getReturnTypes` fails: 

```
return queryPlanCache.getHQLQueryPlan( queryString, false, CollectionHelper.EMPTY_MAP ).getReturnMetadata().getReturnTypes();

```

For some reason the selects on that table are working fine, and I recall seeing a delete work as well on the same table, but I don't know where something might have been lost or changed. The last thing I remember doing was removing all rows from the table, but I don't think that has anything to do with the issue.

Any idea what might be wrong?

This one did work:

```
Query q = em.createNativeQuery("DELETE FROM Table t WHERE row = ?");

```

But I still don't know why the other one does not, and as I said, the selects do work fine.

Here is the stack trace:

```
java.lang.NullPointerException
at org.hibernate.impl.SessionFactoryImpl.getReturnTypes(SessionFactoryImpl.java:812)
at org.hibernate.impl.AbstractQueryImpl.getReturnTypes(AbstractQueryImpl.java:193)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:278)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240)
at $Proxy87.createQuery(Unknown Source)
at com.xyz.persistence.dao.myDAO.deleteStuff(myDao.java:652) 

```