Hibernate domain model
When specifying one to many r开发者_运维技巧elationships in the domain model....is it better to initialize the set?
i.e.
private Set<Book> books = new HashSet<Book>();
OR
private Set<Book> books;
Thxs.
Initializing it in the first place prevents you from null checks all over the place, so my advice would be the first.
It doesn't matter from hibernate perspective. It basically question of basic java practice.
精彩评论