• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with HQL

 
stanislav bashkirtsev
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. I have Customer. It has many Accounts.
2. I have Payment, that has one Account.
Question: how can I fetch all payments where customer=?
The SQL is something like this:
What it will be look like in HQL?
 
Bhavesh Dak
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probable Solution,

Please ignore syntax related flaws.




Cheers,
Bhavesh.
 
stanislav bashkirtsev
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are two of "select"((( It's very bad for performance(
 
Bhavesh Dak
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah that is interesting,

I am also curious if we can achieve this in a single HQL.
 
stanislav bashkirtsev
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe the only way is to create bidirectional relationships...
 
What are you doing? You are supposed to be reading this 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!