This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate many-to-many problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate many-to-many problem" Watch "Hibernate many-to-many problem" New topic

Hibernate many-to-many problem

Alex Kruglov

Joined: May 06, 2008
Posts: 8
Hi, guys!

I have two entities: the first is Publication, which is categorized by the second entity, Tag

Source code follows:

I have to select publications with and without tags (LEFT OUTER JOIN) and then paginate these results with methods setFirstResult and setMaxResults.

1. If use like this

This way I don't get publications without tags.

2. If use like this

This way I get wrong pagination (because I setMaxResults and setFirstResult work for all result rows, not for publications)

Is there any solution to solve both problems? :roll:
Madhucar Gupta

Joined: Aug 28, 2008
Posts: 1
I think, it looks like a bug in Hibernate. Don't you think so?
I agree. Here's the link:
subject: Hibernate many-to-many problem
Similar Threads
How to map a class that has an object that is defined as @Embeddable
Simple requirement .. but I don't know how!
Simple requirement .. but I don't know how!
Help me for Joinin two tables.
how to update OneToMany