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…

Hibernate Tips: What’s the Difference Between @Column(length=50) and @Size(max=50)

Hibernate Tips: What’s the Difference Between @Column(length=50) and @Size(max=50)

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: Some of our entity attributes are annotated with @Column(length=50), others with @Size(max=50) and others with both of these annotations….

Hibernate Tips: How to perform different validations for persist and update

Hibernate Tips: How to perform different validations for persist and update

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: I’m using BeanValidation to validate my entities automatically before they get persisted and updated. I defined different ValidationGroups for…

Hibernate Tips: SINGLE_TABLE strategy without discriminator column

Hibernate Tips: SINGLE_TABLE strategy without discriminator column

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: I need to map tables of a legacy database using the SINGLE_TABLE strategy. But these tables don’t contain a…