Can anybody know when to use Set and when to use List in hibernate mapping file ?
<set name="" table="">
<key>
<column name="" />
</key>
</set>
<list name="" cascade="all">
<key column="" />
<index column="" />
<one-to-many class=""/>
</list>
Thanks.
Take a look at this post: @OneToMany List<> vs Set<> difference
The main difference is that a list has ordering while a set does not. Also, a set cannot have duplicate values, while a list can.