Home » Tag Archives: JBoss Hibernate

Tag Archives: JBoss Hibernate

Hibernate Logging: Tips and Solutions to Common Problems

How to solve some of the most common Hibernate issues with proper logging? Hibernate’s logging configuration is an important but rarely discussed topic. The right configuration can help you to find potential issues during development while a wrong configuration can cause serious performance problems in production. That’s one of the reasons why I explain different configuration options in my new ...

Read More »

Hibernate Caching with HazelCast: Basic configuration

Previously we went through an introduction on JPA caching, the mechanisms and what hibernate offers. What comes next is a hibernate project using Hazelcast as a second level cache. We will use a basic spring boot project for this purpose with JPA. Spring boot uses hibernate as the default JPA provider. Our setup will be pretty close to the one ...

Read More »

Hibernate Caching With HazelCast: JPA caching basics

One of the greatest capabilities of HazelCast is the support for hibernate’s second level cache. JPA has two levels of cache. The first level cache caches an object’s state for the duration of a transaction. By querying the same object twice you have to get the object your retrieved the first time. However in case of complex queries which include ...

Read More »

One-shot Delete with Hibernate (JPA)

In older versions of Hibernate, I can see the one-shot delete indicated in the manual. But newer versions no longer have this section. I’m not sure why. So, in this post, I take a look if it still works. The one-shot delete section says: Deleting collection elements one by one can sometimes be extremely inefficient. Hibernate knows not to do ...

Read More »

Custom Audit Log With Spring And Hibernate

If you need to have automatic auditing of all database operations and you are using Hibernate…you should use Envers or spring data jpa auditing. But if for some reasons you can’t use Envers, you can achieve something similar with hibernate event listeners and spring transaction synchronization. First, start with the event listener. You should capture all insert, update and delete ...

Read More »

Spring-Managed Hibernate Event Listeners

Hibernate offers event listeners as part of its SPI. You can hook your listeners to a number of events, including pre-insert, post-insert, pre-delete, flush, etc. But sometimes in these listeners you want to use spring dependencies. I’ve written previously on how to do that, but hibernate has been upgraded and now there’s a better way (and the old way isn’t ...

Read More »

5 Common Hibernate Exceptions and How to Fix Them

See how you can easily solve the most common issues with Hibernate Hibernate is probably the most popular JPA implementation on the market and you can see that in many places, like: The number of projects in which you’ve used it yourself, The number of job positions which ask for Hibernate experience and of course The number of questions and ...

Read More »

How to handle Stop Words in Hibernate Search 5.5.2 / Apache Lucene 5.4.x?

The Stop Words like [“a”, “an”, “and”, “are”, “as”, “at”, “be”, “but”, “by”, “for”, “if”, “in”, “into”, “is”, “it”, “no”, “not”, “of”, “on”, “or”, “such”, “that”, “the”, “their”, “then”, “there”, “these”, “they”, “this”, “to”, “was”, “will”, “with”] and the existence of them in terms or database or files that are to be indexed/searched by lucene can lead to any of ...

Read More »

Enabling Entity and Query cache in Hibernate

1. Introduction Amongst the performance related tasks I have been through, this has been one of them. The concern is that if the same query is invoked every time for a particular entity and the table data is not liable to change for a particular time slot, we can possibly cache the query results with Hibernate. This means that, if we want the details ...

Read More »