-
MySQL / MariaDb + Hibernate XML Configuration Example
This tutorial shows you how to configure MySQL/MariaDB with Hibernate using XML Configuration. We demonstrate this by inserting a POJO into the database. This POJO and database are configured using XML Configuration.
Date: 2019-08-10 View: 1383
-
MySQL / MariaDb + Hibernate Annotation Configuration Example
Date: 2019-08-10 View: 1238
-
Hibernate c3p0 Connection Pooling Configuration
This tutorial shows you how to configure Hibernate c3p0 Connection Pooling. By default hibernate comes with a built-in connection pool. But this connection pool is by no means production ready. They even advice not to use it in production, as you can see in the logging.
Date: 2019-08-10 View: 1279
-
Configure Hibernate Logging with SLF4j + Logback
This tutorial shows how to configure hibernate with SLF4j and Logback. Logging is an important tool for each developer. So it’s worth setting up right the first time. We configure Logback with a ConsoleAppender for logging to the console and a RollingFileAppender for logging to a file for archival. If you stick around, we’ll also show you how to remove the annoying c3p0 logging.
Date: 2019-08-10 View: 1401
-
Configure Hibernate Logging with slf4j + log4j2
This tutorial shows how to configure hibernate with slf4j and log4j2. Logging is an important tool for each developer. So it’s worth setting up right the first time. We configure two logging appenders. The first is for logging to the console, the second is for logging to a file for archival reasons.
Date: 2019-08-10 View: 1474
-
Hibernate Dbcp Connection Pooling Configuration
This tutorial shows you how to configure Hibernate dbcp Connection Pooling. By default hibernate comes with a built-in connection pool. But this connection pool is by no means production ready. They even advice not to use it in production, as you can see in the logging.
Date: 2019-08-10 View: 1675
-
Hibernate One to One Unidirectional Foreign Key
In this tutorial, we show you how to configure a Hibernate One-to-One Unidirectional Association with Foreign keys using either annotations or xml mapping files.
Date: 2019-08-10 View: 1077
-
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.
Date: 2019-08-10 View: 1082
-
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, java.sql.Time or java.sql.Timestamp. But to avoid dependencies on the java.sql package, it’s common to use java.util or java.time Date/Time classes instead.
Date: 2019-08-10 View: 1152
-
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.
Date: 2019-08-10 View: 963
-
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 be eligible as an embeddable class. We can use the @Embedded annotation to embed an embeddable class. The attributes of embedded class can be overridden using the @AttributeOverrides and the @AttributeOverride annotations. Let’s see how this works, by following this example.
Date: 2019-08-10 View: 1087
-
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.
Date: 2019-08-10 View: 1225
-
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.
Date: 2019-08-10 View: 1226
-
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 couple our code with any ORM framework and easily change from vendor.
Date: 2019-08-10 View: 1510
-
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.
Date: 2019-08-10 View: 1419