This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Query consilidation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Query consilidation" Watch "Query consilidation" New topic

Query consilidation

Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
I have a table that references another table in a one to many relationship. I have the name of one of the objects in the table, and I want to find all of the other objects in the table that refer to the same object in the other table as one that I have. It's not as confusing as it sounds. I've gotten it to work with the following setup. I'm just not sure how to make them work as one query instead of two.

Tomasz Szymanski

Joined: Jan 11, 2010
Posts: 23
Wouldn't this work?
I agree. Here's the link:
subject: Query consilidation
Similar Threads
sql-statement in tuple
problem persisting an object with collections and manytomany relationship
Join Fetch using EclipseLink
Hibernate Query
Hibernate Select - Criteria with a Date