In this example I am going to tell you how to map composite primary key to entity class in your JPA Hibernate entity class. Composite primary key is a combination of two or more columns made together as a primary key. Therefore the combination of column values will be as a unique instead of having…

Posted in Hibernate JPA

How to map Composite Primary Key to Entity Class in JPA Hibernate

In this tutorial I will discuss what are the states of objects (transient persistent and detached objects) in Hibernate framework. You might be knowing that Hibernate is an ORM (Object Relational Mapping), which is an automated persistent of objects in a Java application to the tables in a relational database. Hibernate defines and supports three…

Posted in Hibernate

Hibernate Object States – Transient, Persistent and Detached

Introduction In this tutorial we will discuss about the differences among save(), saveOrUpdate() and persist() method in leading ORM(Object Relational Mapping) tool Hibernate framework. The key thing is all these methods are used to store object(s) into database and they also make transient object(s) into persistent. Hibernate framework’s Session class provides a few ways to…

Posted in Hibernate MySQL

save(), saveOrUpdate(), persist() in Hibernate

Introduction In this tutorial we will discuss how to create Java based Hibernate configurations. In Java based configuration we don’t need to create any XML or properties file for putting Hibernate configuration. We will put Hibernate configuration as well SessionFactory using Java based configuration. To make everything clarified we will create both XML and Java…

Posted in Hibernate

How to create Java based Hibernate Configurations

Introduction In this tutorial we will create an example on Spring Boot MVC and Hibernate CRUD. CRUD is an acronym that means Create, Read, Update and Delete operations. In my other tutorial I had also created Spring Boot MVC and JDBC CRUD Example. We will build the tutorial example using both maven and gradle build…

Posted in Hibernate MySQL Spring Boot

Spring Boot MVC and Hibernate CRUD Example

Introduction In this example we will see an example on how to validate form in web application using Spring Boot framework. We will use Thymeleaf as a template for UI (user interface) or front-end. We will perform almost all kinds of validations available through Hibernate validator framework. This example just validates the input values and…

Posted in Hibernate Spring Boot

Form Validation in Spring Boot Web Application

@Temporal Annotation In this tutorial I am going to tell you what is the use of @Temporal annotation in JPA (Java Persistence API). @Temporal is a JPA annotation and generally specified only for persistent fields or properties of type java.util.Date and java.util.Calendar. Generally you can use @Temporal annotation on the date or calendar field in entity…

Posted in Hibernate JPA

What Is The Use Of @Temporal Annotation In JPA

Introduction This tutorial we show you how to connect multiple database servers using Hibernate framework. We know Hibernate is an ORM (Object Relational Mapping) framework for the automated persistence of objects in a Java application to the tables in a relational database. Here we will assume that an application will connect to MySQL and SQLServer…

Posted in Hibernate

How to connect multiple database servers using Hibernate?

Introduction I am going to show you here what is UserType and why do you need UserType while working with database and web application. In Hibernate UserType Example using Spring Data JPA I will show you how Hibernate allows you to implement and use custom types when built-in types do not satisfy an application’s requirements,…

Posted in Hibernate Spring Boot Spring JPA

Hibernate UserType Example using Spring Data JPA

Introduction Here I am going to show you how to resolve issue org.hibernate.mapping.exception: No Dialect mapping for JDBC type that occurs in your Hibernate based application due to some types mismatch between database table column and Java field. You might have seen similar kind of exception occurred during performing native queries without entity class and…

Posted in Hibernate Spring JPA

org.hibernate.MappingException: No Dialect mapping for JDBC type

Introduction Locking refers to a mechanism taken for granted in a relational database to prevent any modification to the data between the time the data are read and the time the data are used. There are mainly two types of locking strategy available – optimistic and pessimistic

Posted in Hibernate

Hibernate Locking

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…

Posted in Hibernate JSF Spring Core

JSF 2, Spring 4, Hibernate 4 and Maven Integration