开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜