Hibernate Tips: How to Prevent the Removal of a Parent Entity with Children

Hibernate Tips: How to Prevent the Removal of a Parent Entity with Children

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: In one of the previous Hibernate Tips, I showed how to remove child entities automatically when you remove their…

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…

Localized Data – How to Map It With Hibernate

Localized Data – How to Map It With Hibernate

Internationalization not only affects the UI. If your application stores user-generated data and supports multiple languages, you also need a way to store different translations in your database. Typical examples are: market places that allow you to provide product descriptions in various languages, travel sites that offer trips to people all over the world and…