Posted in Hibernate JPA

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

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 a single column value as…

Continue Reading... How to map Composite Primary Key to Entity Class in JPA Hibernate
Posted in Hibernate

Hibernate Object States – Transient, Persistent and Detached

Hibernate Object States In this tutorial I will discuss what are the states of objects (transient persistent 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 different object states:…

Continue Reading... Hibernate Object States – Transient, Persistent and Detached
Posted in Hibernate MySQL

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

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 save objects by methods save(),…

Continue Reading... save(), saveOrUpdate(), persist() in Hibernate
Posted in Hibernate

How to create Java based Hibernate Configurations

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 based configuration so that it…

Continue Reading... How to create Java based Hibernate Configurations
Posted in Hibernate MySQL Spring Boot

Spring Boot MVC and Hibernate CRUD Example

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 tools. We will create the…

Continue Reading... Spring Boot MVC and Hibernate CRUD Example
Posted in Hibernate Spring Boot

Form Validation in Spring Boot Web Application

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 once validated successfully it just…

Continue Reading... Form Validation in Spring Boot Web Application
Posted in Hibernate JPA

What Is The Use Of @Temporal Annotation In JPA

@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 classes while you are mapping…

Continue Reading... What Is The Use Of @Temporal Annotation In JPA
Posted in Hibernate

How to connect multiple database servers using Hibernate?

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 databases at the same time….

Continue Reading... How to connect multiple database servers using Hibernate?
Posted in Hibernate Spring Boot Spring JPA

Hibernate UserType Example using Spring Data JPA

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, or when you want to…

Continue Reading... Hibernate UserType Example using Spring Data JPA
Posted in Hibernate Spring JPA

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

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 this kind of issue may…

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