Home » Enterprise Java » hibernate

hibernate

Hibernate Join Example

Join statements are used when one wants to fetch data from multiple tables of database. Hibernate provides support for join statements where one can write single query to fetch data from multiple tables easily. Hibernate is one of the few JPA (Java Persistence API) providers. Hibernate is extensively used for persistence layer of building an enterprise application. We will show ...

Read More »

Hibernate Insert Example

In this example, we will show how to use hibernate to insert data into database. Hibernate is one of the few JPA (Java Persistence API) provider. Hibernate is extensively used for persistence layer of building a enterprise application. We will configure our hibernate with hibernate.cfg.xml and then we will create an example mapping with example.hbm.xml. We will show how a ...

Read More »

Hibernate Mapping Example

In this example, we will show you how to use hibernate with its mapping capability. We are going to show a one-to-many bi-directional mapping in hibernate using XML mappings. We will configure our hibernate with hibernate.cfg.xml and then we are going to create a mapping with example.hbm.xml . One-to-many relationship is the relationship in which each record in one table ...

Read More »

Hibernate Tutorial For Beginners with Examples

1. Introduction Hibernate is a high performance Object/Relational mapping (ORM) framework completely used in Java. Hibernate also provides query service along with persistence. This gives developers a way to map the object structures in Java classes to relational database tables. ORM framework eases to store the data from object instances into persistence data store and load that data back into ...

Read More »

Hibernate Configuration File Tutorial

In this example, we will show how to configure hibernate. Hibernate requires to know in advance where to find all the mapping information related to java classes and database tables. There are some other database related settings that hibernate needs which are provided through configuration file. These configuration settings can be provided programmatically OR through a configuration file called hibernate.cfg.xml ...

Read More »

Second Level Cache in Hibernate Example

In one of the previous examples, we explained how we can configure Spring Data with JPA using Hibernate as the JPA as the underlying vendor. In this example, we will demonstrate how we can use Second Level Cache in Hibernate to optimize application performance and also avoid common pitfalls. Table Of Contents 1. What is Second Level Cache? 2. Project ...

Read More »

Hibernate First Level Cache Example

In this post we will talk about the Hibernate First Level Cache Strategy. When an application repeatedly hits the database and executes a lot of queries, it’s important as developer to apply a cache between then. Caching recently accessed objects is a very simple way to improve the performance, avoiding having to access the database each time it is required ...

Read More »

Hibernate JPA DAO Example

This is an example of how to create Data Access Objects (DAOs), making use of the Hibernate implementation for the Java Persistence API (JPA) specification. Hibernate is an object-relational mapping library for Java, that provides a framework for mapping an object-oriented domain model to a traditional relational database. When an application interacts with a database, it is common pattern to ...

Read More »

Hibernate Annotations Example

This is an example of how to make use of Hibernate annotations when interacting with a database. Hibernate is an object-relational mapping library for Java, that provides a framework for mapping an object-oriented domain model to a traditional relational database. It is also an implementation of the Java Persistence API (JPA) specification. Hibernate provides an easy way to configure how ...

Read More »

Hibernate validator example

This is an example of how to make use of Hibernate validator API. Hibernate validator can be used to validate data, which is a very important issue in every layer of an application. For example, validating is important when submitting HTML forms. Hibernate validator framework provides many annotations, that can be used to validate input fields of a form against ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns