This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
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

Hibernate: Use List elements in where clause of query

 
Ronwaldo Cruz
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Please help regarding this hibernate query problem:

class A {

Set B;

}

class B {

Date date;

}

I need to find all As that have Bs whose date falls between date1 and date2
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually pretty much exactly like you would in SQL, you join the two tables and just use a Between in your where clause

so similar to

"SELECT a FROM A a JOIN FETCH B b WHERE b.date > ate1 and b.date < ate2"

You can do anything you like in the WHERE clause portion.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic