File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 3860

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]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HQL query with OneToMany