Hibernate version: 3.x (the version included in JBoss 4.0.4GA)
Used query:SELECT new AnObject(x.id, x.subObject.property, x.description) FROM AnObject x;
This is the code that execute the query:
Code:
String queryString = "SELECT new AnObject(x.id, x.subObject.property, x.description) FROM AnObject x";
Query query = entityManager.createQuery(queryString);
List<AnObject> listResult = (List<AnObject>)query.getResultList();
The problem is that all the rows that have subObject at NULL are not returned.
The behaviour that I would like would be that if "subObject" is null, the value returned for "x.subObject.property" is null.
Is that possible? If yes how? If no, what solution are you suggesting?