I'm watching a good video made by Burt Beckwith
http://www.infoq.com/presentations/GORM-Performance
he says:
"In traditional Hibernate you could map the collection as Bag,
which is just a regular Collection with no ordering or uniqueness guarantees"
How Can I map this collection with no ordering or uniqueness with annotation? Thanks.
If you use a List
as the reference type but do not specify an index number column, you will have an unordered collection with no uniqueness requirement. Yes the list is an ordered collection at the java level, but there is no guarantee across copies of the entity that they have the same order.
@OneToMany
private List<OtherEntity> otherEntities;
That's all!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With