Which Java Type do you use for JPA collections and why?

后端 未结 5 1183
走了就别回头了
走了就别回头了 2020-12-22 23:20

Which of the following collection types do you use in your JPA domain model and why:

  • java.util.Collection
  • java.util.List
5条回答
  •  渐次进展
    2020-12-23 00:07

    I use:

    • Set: when the items in the collections have no order and are unique
    • List: when the items has a order

提交回复
热议问题