In this tutorial I will show you how to integrate JSF 2, Spring 4, Hibernate 4 and Maven. In the previous example Spring 3, JSF 2 and Hibernate 3 integration example , I have shown how to integrate JSF 2, Spring 3 and Hibernate 3 but I have not used maven there. For this tutorial […]
This tutorial will sow how we can configure second level cache using OSCache in Hibernate step by step. We know that there are three types of caching mechanism in Hibernate such as First Level – Session, Second Level – SessionFactory and Query Level – SessionFactory. For more information on First Level, Second Level and Query […]
This tutorial will sow how we can configure second level cache using ehcache in Hibernate step by step. EH stands for Easy Hibernate. We know that tehre are three types of caching mechanism such as First Level – session, Second Level – SessionFactory and Query Level – SessionFactory. For more information on First Level, Second […]
There are mainly six important tags for hibernate configuration file. Hibernate configuration file naming convension is generally hibernate.cfg.xml and it is generally placed in the classpath. This can also be configured in the hibernate.properties file. If both hibernate.cfg.xml and hibernate.properties are found in the classpath then hibernate.cfg.xml overrides hibernate.properties file.
This tutorial shows how we can call stored procedure in Hibernate API. Prerequisites Hibernate 3.x jars, mysql-connector-java jar, jdk 1.6, MySQL 5.x 1. Create a Store Procedure in MySQL in database cdcol
I am going to give explaination and example on hibernate table per class hierarchy, consider we have base class named Person and two derived classes – Student and Teacher If we save the derived class object like Student or Teacher then automatically Person class object will also be saved into the database, and in the […]
In Table Per SubClass Hierarchy there will be the number of classes equals to the number of tables in the database. If we save the Student class object, hibernate will first save the data related to super class object into the super class related table in the database and then Student object data in Student […]
In Table Per Concrete Class Hierarchy will have the number of tables in the database equals to the number of derived classes. Once we save the derived class object, then derived class data and base class data will be saved in the derived class related table in the database. We need the tables only for […]
Hibernate uses two different caches for objects: first-level cache and second-level cache. First-level cache is associated with the Session object, while second-level cache is associated with the SessionFactory object. By default, Hibernate uses first-level cache on a per-transaction basis. Hibernate uses this cache mainly to reduce the number of SQL queries it needs to generate […]
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 following example shows how to work with Hibernate Criteria API.