-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate : Repetition in FetchMode.JOIN
PostPosted: Sat Jun 16, 2012 4:10 am 
Newbie

Joined: Sat May 19, 2012 2:36 pm
Posts: 4
I have a dept table and an emp table. The dept table had a one-to-many relation with emp table w.r.t the deptId.

When i tried this code:

Code:
session.createCriteria(Dept.class).setFetchMode("empMap", FetchMode.JOIN)
       .list();


This is the generated output in my console for the sql query generated by the hibernate:

Code:
select this_.DEPT_ID as DEPT1_1_1_, this_.DEPT_NAME as DEPT2_1_1_,
empmap2_.DEPT_ID as DEPT3_3_, empmap2_.EMP_ID as EMP1_3_,
empmap2_.EMP_ID as formula0_3_, empmap2_.EMP_ID as EMP1_0_0_,
empmap2_.EMP_NAME as EMP2_0_0_, empmap2_.DEPT_ID as DEPT3_0_0_,
empmap2_.AGE as AGE0_0_, empmap2_.SEX as SEX0_0_
from dept this_, emp empmap2_
where this_.DEPT_ID=empmap2_.DEPT_ID(+)


In the generated hibernate query I can clearly see that there are repetition in columns of the emp table. But i don't want these repetitions to appear. How to avoid the repetition in the hibernate generated query then?

Please inform how to remove these repetitions.

Regards,


Top
 Profile  
 
 Post subject: Re: Hibernate : Repetition in FetchMode.JOIN
PostPosted: Sat Jun 16, 2012 7:01 am 
Newbie

Joined: Sat May 19, 2012 2:36 pm
Posts: 4
any help on this?


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

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.