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
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply 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: 3563

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
 
Threads others viewed
Enthuware question on inner join
Hibernate HQL Delete query problem
Inner join problem
EJB - Everything works except persist()
Problem with OUTER JOIN hibernate
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com