Hi All, I got tucked in how to map 3 tables correctly so that my HQL/Criteria returns correct result.
I have 3 tables:
Code:
1. UIGrid (GridId (pk), GridName)
2. UIGridColumn (columnId (pk), gridId(fk), name, configurable)
3. UserPreference (prefId (pk), columnId(fk), username, visible)
Exists One-to-Many relationship between tables.
I want to write a query so that it will return all columns for given username and UIGrid.gridIdCode:
select * from uigrid ug
inner join UIGridColumn ugc on ugc.gridId = ug.gridId
left join UserPreference up on up.columnId=ugc.columnId
and ug.gridId=1 and up.username='abcduser'
Can someone help me how to define mapping between these 3 tables (by annotation) ?[color=#0000FF]