File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "HQL query with OneToMany" Watch "HQL query with OneToMany" New topic

HQL query with OneToMany

Kamil Kuchta

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

Joined: Mar 24, 2008
Posts: 3900

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?

[How to ask questions] [Twitter]
I agree. Here's the link:
subject: HQL query with OneToMany
It's not a secret anymore!