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

Join as well as Criteria Query

 
Mahendran Aiyappan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

Table : Child
bla bla

Table : MealChoice
dayDate
bla bla

In the above tables I need a query which should retrieve a list of Child objects where dayDate is between the given dates.

I think I need to use Criteria as well as Join.

I don't have any idea.

Please give me your comments.

regards
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Criteria as well as Join"

Not really a this or that, or "as well as" thing.

You can create your query either using the Criteria interfaces, or the Query HQL/JP-QL interfaces.

In the Criteria interface to create joins you use the createAlias() method to make the joins.

Whichever api you use you will need a Where clause for you date issue. In QL it is just like an SQL where clause, in the Criteria api your need to add Restrictions.

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