Hibernate HQL get all fields from a table as fields list and not as an object

Viewed 25

I need to get all values from a table and one more from another one, I am close to the solution but with the code below I got the object of the first table but I need the list of all fields:

select new map(t1 as tableOne, t2.day as tableTwoDay) from TableOne t1 left join t1.table2 t2  where ...

t1.* doesn't work

Someone can help me? Thanks

1 Answers

You already have all T1 fields: they are mapped as the value for key t1 of resulting map() ; you are using an ORM so working with objects is pretty natural.
If you need all T1 fields as single values in resulting map() just write something similar to:
select new map(T1.field1 as field1, T1.field2 as field2,...,T1.fieldN as fieldN)...

(untested code,just an idea)

Related