Home » Tag Archives: JBoss Hibernate (page 5)

Tag Archives: JBoss Hibernate

A beginner’s guide to JPA/Hibernate entity state transitions

jboss-hibernate-logo

Introduction Hibernate shifts the developer mindset from SQL statements to entity state transitions. Once an entity is actively managed by Hibernate, all changes are going to be automatically propagated to the database. Manipulating domain model entities (along with their associations) is much easier than writing and maintaining SQL statements. Without an ORM tool, adding a new column requires modifying all ...

Read More »

Hibernate hidden gem: the pooled-lo optimizer

jboss-hibernate-logo

Introduction In this post we’ll uncover a sequence identifier generator combining identifier assignment efficiency and interoperability with other external systems (concurrently accessing the underlying database system). Traditionally there have been two sequence identifier strategies to choose from.         The sequence identifier, always hitting the database for every new value assignment. Even with database sequence preallocation we have ...

Read More »

From JPA to Hibernate’s legacy and enhanced identifier generators

jboss-hibernate-logo

JPA identifier generators JPA defines the following identifier strategies:                 Strategy Description AUTO The persistence provider picks the most appropriate identifier strategy supported by the underlying database IDENTITY Identifiers are assigned by a database IDENTITY column SEQUENCE The persistence provider uses a database sequence for generating identifiers TABLE The persistence provider uses a ...

Read More »

Hibernate and UUID identifiers

java-interview-questions-answers

Introduction In my previous post I talked about UUID surrogate keys and the use cases when there are more appropriate than the more common auto-incrementing identifiers. A UUID database type There are several ways to represent a 128-bit UUID, and whenever in doubt I like to resort to Stack Exchange for an expert advice.     Because table identifiers are ...

Read More »

Hibernate Debugging – Finding the origin of a Query

jboss-hibernate-logo

It’s not always immediate why and in which part of the program is Hibernate generating a given SQL query, especially if we are dealing with code that we did not write ourselves. This post will go over how to configure Hibernate query logging, and use that together with other tricks to find out why and where in the program a ...

Read More »

Pitfalls of the Hibernate Second-Level / Query Caches

jboss-hibernate-logo

This post will go through how to setup the Hibernate Second-Level and Query caches, how they work and what are their most common pitfalls. The Hibernate second level cache is an application level cache for storing entity data. The query cache is a separate cache that stores query results only. The two caches really go together, as there are not ...

Read More »

A beginner’s guide to Hibernate Types

jboss-hibernate-logo

The basic mapping concepts When learning Hibernate many like to jump to parent-child associations without mastering the object relation mapping basics. It’s very important to understand the basic mapping rules for individual Entities before starting modelling Entity associations. Hibernate types A Hibernate type is a bridge between an SQL type and a Java primitive/Object type.   These are the types ...

Read More »

The minimal configuration for testing Hibernate

jboss-hibernate-logo

Introduction In my previous post I announced my intention of creating a personal Hibernate course. The first thing to start with is a minimal testing configuration. The examples are relevant for Hibernate 4. You only need Hibernate In a real production environment you won’t use Hibernate alone, as you may integrate it in a JEE or Spring container. For testing ...

Read More »

Spring/Hibernate improved SQL logging with log4jdbc

jboss-hibernate-logo

Hibernate provides SQL logging out of the box, but such logging only shows prepared statements, and not the actual SQL queries sent to the database. It also does not log the execution time of each query, which is useful for performance troubleshooting. This blog post will go over how to setup Hibernate query logging, and then compare it to the ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.