• Post Reply Bookmark Topic Watch Topic
  • New Topic

Join as well as Criteria Query  RSS feed

 
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: 17309
11
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!