How are joins handled using HQL.

Showing Answers 1 - 2 of 2 Answers

Sivakumar Karuppiah

  • Aug 15th, 2007
 

Its just like RDBMS joining.  After joining two or more tables we are retriving values from different tables.
In HQL, The tables are our Value Objects (VOs). when we apply join on two more VOs we got a result list which contains values from different VOs. How to hold these values. There is no VO is available for holding these dynamically created result list.
So, create a POJO class  to hold this result. when you are querying form one or more VOs put  the result list into the newly created VO.

Eg:

select new joinVO (userVO.usercode, UserVO.Username,subjectVo.SubjectName) from UserVO, subjectVO where ......

  Was this answer useful?  Yes

HQL provides four ways of expressing (inner and outer) joins:

1) An ordinary join in the from clause
2) A fetch join in the from clause
3) A theta-style join in the where clause
4) An implicit association join

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions