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…

How to lazily load non-relational attributes in a portable way
|

How to lazily load non-relational attributes in a portable way

JPA’s @Basic annotation supports a fetch attribute that you can use to define the FetchType of an entity attribute. That seems to be the same approach as you use to define the fetching behavior of an entity association. So, lazy loading of non-relational entity attributes should be easy, right? Well, unfortunately, it isn’t that easy….