Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to do inner join while working with set in Hibernate  RSS feed

 
Saathvik Reddy
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using hibernate 3.1

I have a one-to-many association. I am using a set to represent the same.
By default hibernate retrieves the associated instance using an outer join but i want it to be inner join. How can i achieve this?

if you need any further details i will post them.

Please help me solve this issue?
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will have to do this manually. So using a theta-style join, where the two id are joined through the WHERE clause like "WHERE a.pkid = b.fkid"

Or you can do it through an SQLQuery.

Mark
 
Saathvik Reddy
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,

Thanks for the reply. Is this the only way i can solve the issue.
because if i use theta-style joins i need to manually map the result back to the java objects.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!