Hibernate Tips: How to Exclude Deactivated Elements from an Association

Hibernate Tips: How to Exclude Deactivated Elements from an Association

Hibernate Tips is a series of posts in which I describe a quick and easy solution for common Hibernate questions. If you have a question for a future Hibernate Tip, please post a comment below. Question: This Hibernate Tip was inspired by a question I answered on Stack Overflow. The user had to map a…

How to parse a String into an EntityGraph with Hibernate 5.4
|

How to parse a String into an EntityGraph with Hibernate 5.4

JPA 2.1 introduced the annotation-based Named Entity Graphs and the Entity Graph API. They provide query-independent ways to define which entity attributes Hibernate shall fetch from the database. And while you can’t omit eagerly fetched associations or attributes with Hibernate, you can specify a query-specific eager loading for a graph of associations. Sounds great, doesn’t…

Ultimate Guide to Implementing equals() and hashCode() with Hibernate
|

Ultimate Guide to Implementing equals() and hashCode() with Hibernate

The implementation of the equals() and hashCode() methods for entity classes is an often discussed question. Do you really need them? There are lots of applications that work perfectly fine using Java’s default methods provided by the Object class. And if you need to implement them, how should you do that? Should you use all attributes…

5 Things Beginners Need to Know Before Using JPA / Hibernate / EclipseLink
|

5 Things Beginners Need to Know Before Using JPA / Hibernate / EclipseLink

A solid understanding of JPA and its implementations is still one of the most in-demand skills among Java developers. So, it’s no surprise that there are several blog posts, books, and courses available that teach you how to implement a persistence layer using the JPA specification. I even recorded a JPA for Beginners course myself. But…