When treating the root of a criteria query on a type that does not have subtypes, an invalid null = null is rendered in the query, causing the query to never return any rows. I understand this is a rather strange query, and quite easy to work around (do not treat), but I suspect it is also quite easy to fix. I've attached a testcase that performs the following criteria query: {code} CriteriaBuilder cb = entityManager.getCriteriaBuilder(); CriteriaQuery<MyEntity> query = cb.createQuery(MyEntity.class); Root<MyEntity> root = query.from(MyEntity.class); query.select(cb.treat(root, MyEntity.class)); {code}
This results in the following SQL: {code} select myentity0_.id as id1_0_ from MyEntity myentity0_ where null=null {code} |
|