As described in this [forum thread|https://discourse.hibernate.org/t/nativequery-with-entitygraphs-causes-a-classcastexception/532], the {{ ClassCastException QueryException }} is not very meaningful :
{code:java} java . lang.IllegalArgumentException: org.hibernate.QueryException: could not resolve property: bar_id of: org.hibernate.jpa.test.graphs.EntityGraphNativeQueryTest$Foo [select f.id as id, f.bar_id as bar_id, f.baz_id as baz_id from org.hibernate.jpa.test.graphs.EntityGraphNativeQueryTest$Foo f] {code}
I think that entity graphs should be applied to entity queries only, not to native SQL queries. Therefore, we might want to enforce this rule with a HibernateException. |
|