Hibernate JPA persistence

A (definitive?) guide on LazyInitializationException

Posts that have been written about Hibernate’s LazyInitializationException could probably fill whole books. Yet, I believe each of them focuses on a particular aspect of it: some on a specific solution, some on how to solve it with Spring Boot, etc. I’d like this post to be the definitive guide on the subject, even though I’m pretty sure it won’t. At least, I’ll be able to point others to it. The root cause Whether you love or hate ORM frameworks in general, they

hibernate query JPA persistence

Hibernate's Query-By-Example

Despite the current trend regarding &nbps;ORM frameworks, I never had any issue using JPA nor Hibernate. I must admit that my use-cases were pretty simple. Also, since that was already some years ago, we hosted those applications on our own on-site infrastructure so that the search for the ultimate performance - and its associated savings - was not a goal; empowering junior developers who were not familiar with a lot of technologies was. Interestingly enough, Hibernate actually predates JPA, so

hibernate jooq persistence

No more Hibernate? Really?

I recently stumbled upon this punchy one-liner: No More Hibernate!. At first, I couldn’t believe what I read. Then, scrolling down, I noticed that the site was linked to jOOQ, a framework that advocates for SQL to have a first-class status in Java: SQL was never meant to be abstracted. To be confined in the narrow boundaries of heavy mappers, hiding the beauty and simplicity of relational data. SQL was never meant to be object-oriented. SQL was never meant to be anything other than

envers hibernate persistence

How to test code that uses Envers

Envers is a Hibernate module that can be configured to automatically audit changes made to your entities. Each audited entity are thus associated with a list of revisions, each revision capturing the state of the entity when a change occurs. There is however an obstacle I came across while I was 'unit testing' my DAO, and that’s what I want to share to avoid others to fall in the same pit. First, let’s have an overview of the couple of steps needed to use Envers: Annotate your enti

hibernate persistence spring

Spring Persistence with Hibernate

This review is about Spring Persistence with Hibernate by Ahmad Reza Seddighi from Packt Publishing. Facts 15 chapters, 441 pages, 38€99This book is intended for beginners but more experienced developers can learn a thing or twoThis book covers Hibernate and Spring in relation to persistence Pros The scope of this book is what makes it very interesting. Many books talk about Hibernate and many talk about Spring. Yet, I do not know of many which talk about the use of both in relation to per

hibernate jpa persistence

Framework agnostic JPA

With new JEE 5 standard has come the EJB3 specifications. From an historical point of view, EJBs come into 3 different flavors: (i) Entity for persistence, (ii) Session for business logic and (iii) Message-Driven for listeners. Entity EJB are the most time-consuming to develop in their 2.1 version. Apart from the inherent complexity of EJB (local and remote interfaces, homes), developing an EJB 2 is error-prone because of the mapping mechanism. All in all, EJB 2 development really needs a very sp