-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Mapping between 3 tables
PostPosted: Mon Jul 20, 2015 12:22 pm 
Newbie

Joined: Mon Jul 20, 2015 12:09 pm
Posts: 1
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.gridId


Code:
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]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.