hibernate文档给出了我们在Hibernate中使用一对多关联时的一些规则:
http://docs.jboss.org/hibernate/orm/3.3/reference/en-US/html/collections.html#collections-onetomany
A one-to-many association links the tables of two classes via a foreign key with no intervening collection table. This mapping loses certain semantics of normal Java collections:
- An instance of the contained entity class cannot belong to more than one instance of the collection.
- An instance of the contained entity class cannot appear at more than one value of the collection index.
请帮助我理解这些陈述。
假设我有一个产品并且它有零件集合,现在根据要点对我的产品及其零件应用了什么样的限制?
最佳答案
- 一个部件不能属于 2 个或多个产品
- 一个部件不能在产品部件集合中出现多次
关于java - hibernate中的一对多关联,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19757360/