Previous | Home | Next |
The following three steps are required in executeing HQL queries.
- Obtaining an instance of org.hibernate.Query
- Customize the Query object
- Execute the Query
A Query instance is obtained by calling Session.createQuery() or Session.getNamedQuery method. The createQuery() method is used to create a new instance of Query for given HQL Query.
Customize the Query objectAfter obtaining the query object we may want to customize it by setting query parameter,cache mode, Flush mode,fetch size ,an upper limit for the result set.
Execute the QueryAfter preparing the query object by setting all custom properties we use list(),scroll(),iterate() or uniqueResult().
Previous | Home | Next |