Hi All,
My requirement is as follows
We have two tables
Table: ADMIN
Columns:
Code:
ADMIN_ID NAME TYPE
1 aname T1
Hibernate Entity: Admin
Table: ROLES
Columns:
Code:
ADMIN_ID ROLE
1 user admin
1 group admin
Hibernate Entity: Roles
One Admin can have many Roles.
I was writing following SQL in old implementation
select a.NAME, (select CAST(MULTISET(b.ROLE) as ILIST) from ROLES b) from ADMIN a where a. ADMIN_ID=b.ADMIN_ID;Here ILIST is oracle CUSTOM object as follows
CREATE TYPE ILIST AS TABLE OF VARCHAR2(120);Result of above query is String
aname and Array
(user admin, group admin)I want to do the same in HQL. Is it possible in anyway in HQL?? I read alsmost everything on internet about hibernate but didnt get anything.
I dont want to get data like
Code:
aname 'user admin'
aname 'group admin'
here aname is repeating.
The queries in my system are complex and its difficult to process the result to remove redundancy.
Please help me in this regard, any links, code, suggestion or utility will be appreciated.