>I think if it sets a collection to null there may be a serious issue.
Agreed, but that is not the issue. The issue is when you have a detached
Entity and a lazy collection that was not accessed while it was in an
active persistence context, the collection should be null.

> I have seen it happen that even if I initialize  a oneToMany (OTM) var to
a collection, then it gets set it to null when an existing entity is
loaded.... That may be on detached entities only, not sure...
I'm not entirely sure what the case is that you are commenting on ( a small
UT would help clear things up), but the following line from the spec might
be applicable?

"The persistence provider must not merge fields marked LAZY that have not
been fetched: it must ignore
such fields when merging."

On Mon, Nov 7, 2011 at 4:46 PM, areider <open...@reider.net> wrote:

> I think if it sets a collection to null there may be a serious issue. On my
> version 1.2.3_snapshot that comes with RAD 7.5.x, I have seen it happen
> that
> even if I initialize  a oneToMany (OTM) var to a collection, then it gets
> set it to null when an existing entity is loaded. Much worse, any attempt
> to
> assign a collection to the variable gets ignored, presumably due to
> bytecode
> modification. So even a lazy init of the var in a getter wont work. Which
> makes it impossible to add an element on existing entity OTM. That may be
> on
> detached entities only, not sure...
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/Should-OpenJPA-initialise-empty-collections-tp6926980p6972405.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>



-- 
*Rick Curtis*

Reply via email to