I have two entities a) Student d) Address
I have not defined mappings between them (means in oject model I have not defined any mapping between these two but in database schema I have mapping between these two which is one to one) and for some students I may not have data in address table ....I dont want to define one to one relaion ship on object model...so my question is can I write HQL which has left Outer join ?
in SQL I fire query:- select * from student st left outer join address ad on st.studentId = ad.studentRfNum; my DB design is :-
CREATE TABLE `student` ( `name` varchar(50) DEFAULT NULL, `age` int(4) DEFAULT NULL, `studentId` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`studentId`) ) ENGINE=InnoDB;
CREATE TABLE `address` ( `ADDRESSID` int(11) NOT NULL AUTO_INCREMENT, `studentRfNum` int(11) NOT NULL, `ADDLINE` varchar(45) NOT NULL, `CITY` varchar(45) NOT NULL, `STATE` varchar(45) NOT NULL, `COUNTRY` varchar(45) NOT NULL, PRIMARY KEY (`ADDRESSID`) ) ENGINE=InnoDB;
so is there any way to write HQL equivilant to above SQL? or is there anything which I am missing?
|