Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • 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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic