thanks for the answers
"jaikiran" wrote : Well, that's what the user would expect right? If someone
explicitly sets it to null, then he should get back null, isn't it?
Yes, you are right. In the case of collection initalisation the other approach is more
appropriate.
When I think about it, the lazy initalization approach in the getters came from handling
embedded components.
As defined by hibernate, the embedded component will be null, if all its elements are
null.
so hibernate would set the embedded component to null, if all its fields in the database
are null.
that would break code like this:
myEntity().getEmbedded().setEmbeddedField(someValue)
In this case this initalization would not help:
private EmbeddedComponentTyp embedded = new EmbeddedComponentTyp();
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4168977#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...