I'm trying to write an HQL query like so :
select distinct new com.myproject.entities.MyPerson(person.firstName , person.lastName, person.age, address.streetName) from Person person, Address address
I'd like to fetch BOTH the instances of MyObject where the age is null along with the ones where age is not null. I've tried the following, which did not work :
select distinct new com.myproject.entities.MyObject(person.name, person.lastName, null, address.streetName) from Person person, Address address
I've also created a constructor that only takes the firstName, lastName and streetName params, and tried to write the following query :
select distinct new com.myproject.entities.MyObject(person.name, person.lastName, person.age, address.streetName), new com.myproject.entities.MyObject(person.name, person.lastName, address.streetName) from Person person, Address address
That one did not work either due to a syntax error (the ',').
At this point I'm not sure how to do it. Is it even possible ?