Should I write equals() and hashCode() methods in JPA entities?

后端 未结 6 1860
说谎
说谎 2020-11-28 19:35

I want to check if entity is in a Collection member (@OneToMany or @ManyToMany) of another entity:

if (entity2.getEntities1().conta         


        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-28 20:20

    That's the only way. You may want to try Pojomatic library which does the hard job for you.

提交回复
热议问题