File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Join as well as Criteria Query Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "Join as well as Criteria Query" Watch "Join as well as Criteria Query" New topic
Author

Join as well as Criteria Query

Mahendran Aiyappan
Ranch Hand

Joined: Sep 05, 2005
Posts: 102
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

Joined: Feb 05, 2001
Posts: 16622

"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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
 
subject: Join as well as Criteria Query
 
Threads others viewed
Need help for Many to Many association
simple inner join question
how to Join tables in Hibernate Spring in java
Counting number of records in result set
Create Criteria in Hibernate
developer file tools