Home » hibernate » Page 7

Tag Archives: hibernate

Order query resultset in Hibernate with Criteria

This is an example of how to order a query resultset in Hibernate with Criteria. In Hibernate, Criteria is a simplified API for retrieving entities by composing Criterion objects. This is a very convenient approach for functionality like “search” screens where there is a variable number of conditions to be placed upon the result set. The Session is a factory ...

Read More »

Retrieve record in Hibernate with Criteria

In this example we shall show you how to retrieve a record in Hibernate with Criteria. To retrieve a record in Hibernate with Criteria we have performed the following steps: Employee class is the class whose objects will be inserted to the database. In RetrieveRecordInHibernateWithCriteria we use the Hibernate API to make the interface with the database. We create a ...

Read More »

Count total records in Hibernate with Projections

With this example we are going to demonstrate how to count total records in Hibernate using the Projections Class. In short, to count the total records in Hibernate using Projections we have set the example below: Employee class is the class whose objects will be inserted to the database. In CountTotalRecordsInHibernateWithProjections we use the Hibernate API to make the interface ...

Read More »

Pagination in Hibernate with Criteria API

This is an example of how to use pagination in Hibernate using the Criteria API. A typical way to create pagination over the results of a database is to define the number of rows per page and the number of pages. In order to use the pagination in Hibernate with Criteria API we have set the example below: Employee class ...

Read More »

Pagination in Hibernate with query results

In this example we shall show you how to use pagination in Hibernate with query results. To use pagination in Hibernate with query results we have set the example below: Employee class is the class whose objects will be inserted to the database. In PaginationInHibernateWithQueryResults we use the Hibernate API to make the interface with the database. We create a ...

Read More »

Retrieve object by Id in Hibernate

With this example we are going to demonstrate how to retrieve an object by id in Hibernate. In short, to retrieve an object by id in Hibernate  we have set the example below: Employee class is the class whose objects will be inserted to the database. In RetrieveObjectByIdInHibernate we use the Hibernate API to make the interface with the database. ...

Read More »

Set limit in Hibernate query result

This is an example of how to set limit in Hibernate query result. In order to set limit to a query result in Hibernate we have set the example below: Employee class is the class whose objects will be inserted to the database. In SetLimitInHibernateQueryResult we use the Hibernate API to make the interface with the database. We create a new ...

Read More »

Delete persistent object with Hibernate

In this example we shall show you how to delete a persistent object with Hibernate. To delete a persistent object with Hibernate we have set the example below: Employee class is the class whose objects will be inserted to the database. In DeletePersistentObjectWithHibernate we use the Hibernate API to make the interface with the database. We create a new Configuration, ...

Read More »

Retrieve objects in Hibernate with HQL query

With this example we are going to demonstrate how to retrieve objects in Hibernate with HQL query. In short, to retrieve objects in Hibernate with HQL query  we have set the example below: Employee class is the class whose objects will be inserted to the database. In RetrieveObjectsInHibernateWithHQLQuery we use the Hibernate API to make the interface with the database. ...

Read More »

Persist object with Hibernate

This is an example of how to persist an object with Hibernate. To persist an object with Hibernate  we have set the example below: In PersistOjectWithHibernate we use the Hibernate API to make the interface with the database. We create a new Configuration, that allows the application to specify properties and mapping documents to be used when creating a SessionFactory. ...

Read More »