Hibernate Performance Tuning Done Right

Hibernate Performance Tuning Done Right

Optimizing the performance of your application is a complex and application-specific task. All domain models are different, and often enough, the amount of data managed by them also differs significantly between multiple installations. In addition to that, almost all performance tuning techniques have trade-offs, which don’t make them a great fit for all situations. Because…

Hibernate Query Spaces – Optimizing Flush and Cache Operations
|

Hibernate Query Spaces – Optimizing Flush and Cache Operations

Hibernate needs to ensure that all tables referenced in a query are up to date before executing the query. That means it has to flush all pending changes for these tables before it runs the query. Otherwise, the database would process the query on an outdated data set and return wrong results. Hibernate not only…

Implementing Batch Jobs with Hibernate
|

Implementing Batch Jobs with Hibernate

Like most Java developers, you probably use Hibernate directly or via Spring Data JPA to implement your application’s persistence layer. In general, this works very well for most use cases, but it causes some issues if you need to implement a batch job. This is because Hibernate, like most object-relational mapping frameworks, maps each database…

How to use Ehcache as Hibernate’s 2nd Level Cache

How to use Ehcache as Hibernate’s 2nd Level Cache

Using JPA’s and Hibernate’s 2nd level cache can improve the performance of your persistence layer. It acts as a session-independent entity store. Hibernate uses it whenever you call the find method on your EntityManager or traverse an association to fetch a cached entity. Instead of executing a database query, Hibernate gets the entity object from…