Category: Database
Hibernate/JPA Joined Table Inheritance Example
In this tutorial, we show how to map entity hierarchies onto database tables. There are several ways of mapping inheritance to the database. Here, we’ll look into Hibernate/JPA joined table inheritance. The base class...
Hibernate/JPA Single Table Inheritance Example
In this tutorial, we show how to map entity hierarchies onto database tables. There are several ways of mapping inheritance to the database. Here, we’ll look into Hibernate/JPA single table inheritance. The single table...
JPA EntityManager Example
This tutorial shows how to work with the Java Persistence API. The purpose of JPA is to create an abstraction layer between the database layer and an ORM framework. This enables us to loosely...
Hibernate Dynamic-Update Attriburte Example
This tutorial shows how to use the dynamic-update attribute or @DynamicUpdate annotation used by Hibernate. This attribute/annotation tells Hibernate to only include the updated properties of the entity in the SQL UPDATE Statement. Dynamic-update=false...
Hibernate dynamic-insert attriburte example
This tutorial shows how to use the dynamic-insert attribute or @DynamicInsert annotation used by Hibernate. This attribute/annotation tells Hibernate whether to include null properties in the SQL INSERT statement. Dynamic-insert=false By default, dynamic-insert is...
Hibernate @Embeddable and @Embedded Annotation Example
In this tutorial we show how to embed one entity inside another entity, so they are mapped to a single table. With Hibernate we can use the @Embeddable annotation to mark a class to...
Mapping Enum Types with Hibernate Example
In this tutorial we show how to persist Java Enum types using Hibernate. Hibernate supports the mapping of Java enums as basic value types in various ways. The @Enumerated annotation is the original JPA-compliant...
Hibernate Date, Time and DateTime Mapping
In this tutorial we show how to work with java.lang.Date to store Date, Time and DateTime using Hibernate Annotations or XML Mappings. Hibernate allows various Java Date/Time classes to be mapped. Like the java.sql.Date,...
Hibernate One to One Unidirectional Shared Primary Key
In this tutorial, we show you how to configure a Hibernate One-to-One Unidirectional Association with shared primary key using either annotations or xml mapping files. A one-to-one mapping means that one object can have...