Home » Enterprise Java » hibernate

hibernate

Hibernate Example Code Using Annotations

Hibernate annotations is the powerful way to provide the metadata for the Object and Relational Table mapping. All the metadata is clubbed into the POJO Java file along with the code which helps the user to understand the table structure and POJO simultaneously during the development. In this tutorial, we will explain how to configure Hibernate annotations to define mapping ...

Read More »

Hibernate Example Directory Structure

In this tutorial, I will show you how to setup a Hibernate project with Eclipse. 1. Introduction Hibernate is an ORM (Object relational mapping) tool for java applications. ORM provides a technique for mapping a data representation from object model to relational data model with an SQL (Structured Query Language) based database schema. Hibernate provides data retrieval facilities, the data query, ...

Read More »

Hibernate JNDI Example

A database connection is expensive to make, yet all web applications use it. That is why most of the servlet containers provide built-in support for connection pooling. We can leverage this connection pooling in any webserver by registering the datasource via the JNDI context. In this tutorial, we will explain how to configure a datasource in Tomcat and how to ...

Read More »

Hibernate Mapping Types Example

Hello, in this tutorial we will see the different mapping types that are available in Hibernate. 1. Introduction Hibernate is a framework that simplifies the development of Java application to interact with the database. It is an open source, lightweight, ORM (Object Relational Mapping) tool. 1.1 What is Hibernate? Hibernate is the Opensource light weight ORM (Object Relational Mapping) based ...

Read More »

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 »

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