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

后端 未结 5 1136
走了就别回头了
走了就别回头了 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:02

    I think using Collection as the generic default when generating entities with Netbeans is a good starting point, then when you figure out what your model actually is and need more functionality you can easily change it and stay backwards compatible.

提交回复
热议问题