Home » hibernate » Page 5

Tag Archives: hibernate

Hibernate One to Many Example

One-to-Many mapping means that one row in a table can be mapped to multiple rows in another table but multiple rows can be associated with only one instance of the first entity. It is 1-to-n relationship. For example, in any company, an employee can register multiple bank accounts but one bank account will be associated with one and only one ...

Read More »

Hibernate Many to Many Example

Many-to-Many mapping is usually implemented in the database using a Join Table. For example, we can have Cart and Item tables and Cart_Items table for many-to-many mapping. Every cart can have multiple items and every item can be part of multiple carts, so we have a many to many mapping here. In this tutorial, we will learn about how to ...

Read More »

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 ...

Read More »

JSF Hibernate CRUD Example

Hello, in this tutorial I would like to show the usage of Hibernate framework in a simple jsf application and will demonstrate the following: Student form Performing database operations Sending & retrieving data to & from a managed bean This example will show how to develop a simple CRUD (Create, Read, Update, Delete) application and lets you manage student’s database ...

Read More »

20 Spring Framework Best Practices

Spring Application Framework has been in action for quite a long time, and programmers have developed several conventions, usage patterns, and idioms during that time period. In this example, we will try to explain some of them and give examples to illustrate how to apply them in your projects. Let’s begin. Table Of Contents 1. Define singleton beans with names ...

Read More »

Spring MVC Hibernate Tutorial

1. Introduction To develop web applications these days, we use Modern View Controller architecture. Spring provides MVC framework with ready components that can be used to develop flexible and loosely coupled web applications. MVC framework provides separation between input logic, business logic and UI logic. Model encapsulates the application data View is responsible for rendering the model data Controller is ...

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 »