• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate: Use List elements in where clause of query  RSS feed

 
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: 17309
11
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!