Avoid using Set for bidirectional JPA OneToMany collections

Introduction In this article, we are going to see why there is no benefit in using the Set collection type when mapping a bidirectional JPA OneToMany association. While the @OneToMany annotation can be used to map both unidirectional and bidirectional associations, as I explained this article, you should avoid the unidirectional mapping since it can lead to very inefficient SQL statements.

The best way to implement equals, hashCode, and toString with JPA and Hibernate

Bytecode enhancement and toString Last week, Mark Struberg, who is an Apache Software Foundation member and OpenJPA contributor, made the following statement: