简体   繁体   中英

HQL query with @JoinCoumn mapping returns object[] instead of Object

I have this HQL query:

from Usergroup as us join us.user

where Usergroup and User are both types. But when the data is fetched. It returns an ArrayList that contains Object[] that cotnain the Usergroup and the corresponding User.

Where as with from Usergroup returns an ArrayList of Usergroup objects...

Is there a way that I can return the former query as just an ArrayList of Usergroup objects like the latter query, I don't know why it returns an object array like that...?

If you select more than one "thing", Hibernate will give you an array.

If you don't specify what you want to select from a join of two entities, it will give you both.

Try

select us from Usergroup as us join us.user

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM