Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes EJB and other Java EE Technologies and the fly likes EJB QL w/ ManyToMany 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 » Java » EJB and other Java EE Technologies
Bookmark "EJB QL w/ ManyToMany" Watch "EJB QL w/ ManyToMany" New topic
Author

EJB QL w/ ManyToMany

Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
My SQL is a little weak. You toss in the mutant alien cross with EJB and it confuses me even more. If anyone could give me some insight into this ManyToMany relationship and how to query across it, I would appreciate it.

Some code snippits included. All insert into and retrieve from the DB fine.



Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
I ferreted out a result. Or two actually, but I think they're equivalent. If you know of a better or more common solution, please let me know!




either of these requires a slightly different setting of the parameters of the Query before it is invoked:



And, of course, flatting it out into one annotation makes it much harder to understand:


[ March 05, 2008: Message edited by: Bill Shirley ]
[ March 05, 2008: Message edited by: Bill Shirley ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB QL w/ ManyToMany
 
Similar Threads
How to link existing record from database table in ManyToMany Uni-directional relationship
@ManyToMany and Select query
The link table of ManyToMany annotation is not updated in Hibernate
Confused with many to many,
ManyToMany relationship with extra field in the joinTable