-->
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: Hibernate Mapping for JOIN on column other than primarykey
PostPosted: Tue Jan 20, 2009 11:18 am 
Newbie

Joined: Tue Jan 20, 2009 11:08 am
Posts: 2
Hibernate version: 3

I new to Hibernate.

I have a table -

CREATE TABLE `frac_fshell_srv`.`frac75_organization_domain_geography_association` (
`ODGA_ID` char(7) NOT NULL,
`ODGA_ORG_ID` char(7) NOT NULL,
`ODGA_DM_ID` char(7) NOT NULL,
`ODGA_GM_ID` char(7) NOT NULL,
`ODGA_Created_By` char(7) NOT NULL,
`ODGA_Created_DateTime` datetime NOT NULL,
`ODGA_LastModified_By` char(7) NOT NULL,
`ODGA_LastModified_Datetime` datetime NOT NULL,
`ODGA_Archive_State` int(10) unsigned NOT NULL,
PRIMARY KEY (`ODGA_ID`),
KEY `FK_frac75_organization_domain_geography_association_ODGA_DM_ID` (`ODGA_DM_ID`),
KEY `FK_frac75_organization_domain_geography_association_ODGA_GM_ID` (`ODGA_GM_ID`),
CONSTRAINT `FK_frac75_organization_domain_geography_association_ODGA_GM_ID` FOREIGN KEY (`ODGA_GM_ID`) REFERENCES `frac75_geography_master` (`GM_ID`),
CONSTRAINT `FK_frac75_organization_domain_geography_association_ODGA_DM_ID` FOREIGN KEY (`ODGA_DM_ID`) REFERENCES `frac75_domain_master` (`DM_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


As you can see I want Hibernate to generate a query like this so that I can have a grid and display that to user.

The Select Statement -
Select .....DM_Name, .....GM_Name
from frac75_organization_domain_geography_association
inner join frac75_domain_master on dm_id=odga_dm_id
inner join frac75_geography_master on gm_id=odga_gm_id


Any Ideas Please?


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.