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 HQL query with OneToMany 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 "HQL query with OneToMany" Watch "HQL query with OneToMany" New topic
Author

HQL query with OneToMany

Kamil Kuchta
Greenhorn

Joined: Mar 09, 2009
Posts: 17
I have problem to create some HQL query.
This is my object model. Hotel has list of Image.


Standard SQL in this case is easy:

But how to create HQL?
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3817

Isn't the relationship bi-directional? You have to reference Hotel from the Image as Many side of One-To-Many will be the owner of the relationship. HQL is bit different form SQL. Are you trying to execute a native SQL or HQL?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
 
 
subject: HQL query with OneToMany
 
Similar Threads
Inner join problem
Hibernate HQL Delete query problem
Problem with OUTER JOIN hibernate
EJB - Everything works except persist()
Enthuware question on inner join