Access Strategies in JPA and Hibernate – Which is better, field or property access?
|

Access Strategies in JPA and Hibernate – Which is better, field or property access?

The access strategy defines how your JPA implementation, e.g., Hibernate or EclipseLink, access your entity attributes. You can choose between field-based access and property-based access: If you use field-based access, your JPA implementation uses reflection to read or write your entity attributes directly. It also expects that you place your mapping annotations on your entity attributes….

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…

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…