imagine you have a Hibernate/JPA entity class Text which may be annotated with multiple members of class Tag - how would you ensure that Text ent开发者_JAVA百科ity exist only once for a set an arbitrary combination of Tags?
Thank you for help.
I would make a hash of the keys of the Tags and put a unique key on that. There isn't really any built in way to ensure a Bag's contents are unique.
精彩评论