• Post Reply Bookmark Topic Watch Topic
  • New Topic

HQL query with OneToMany

 
Kamil Kuchta
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3953
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!