Hibernate - Exception "node to traverse cannot be null"

September 21, 2016

Problem:

Hibernate exception “java.lang.IllegalArgumentException: node to traverse cannot be null”
Query query = session.createQuery(“delete " +
“(…) " +
“where map_material.id > map_material_1.id " +
" and map_material.map_key = map_material_1.map_key " +
“(…) "

Solution:

Make sure to use hibernate “createSQLQuery” method
Query query = session.createSQLQuery(“delete " +
“(…) " +
“where map_material.id > map_material_1.id " +
“and map_material.map_key = map_material_1.map_key " +
“(…) "