Hibernate Tip: How does Hibernate’s native ID generator work

Hibernate Tip: How does Hibernate’s native ID generator work

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: One of the readers of my article about using Hibernate with a MySQL database asked the following question: What is…

5 Primary Key Mappings for JPA and Hibernate Every Developer Should Know

5 Primary Key Mappings for JPA and Hibernate Every Developer Should Know

Mapping a primary key column with JPA and Hibernate is simple. You just need to add an attribute to your entity, make sure that its type and name match the database column, annotate it with @Column and you’re done. You can then use the primary key to load the entity, and Hibernate sets the primary…

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…