You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Fredrik Jonson <fr...@myrealbox.com> on 2009/03/18 08:58:12 UTC

Re: Unexpected behaviour from @OneToMany with FetchType.LAZY (SOLVED)

I wrote:

>  I can't get my @OneToMany references with FetchType.LAZY to become
>  populated by openjpa in geronimo. Using FetchType.EAGER works as
>  expected. Using OpenJPA standalone (in unit tests) and
>  transaction-type=LOCAL works too. But when I deploy the code in
>  geronimo my LAZY-fetched OneToMany relations are not populated.

False alarm. After poking around a bit more I noticed that the calling
code wasn't in a transaction. The customer entity was detached from the
entity manager long before the lazy-loaded resource had been populated.

BTW, while pondering I found a excellent introduction to JPA transactions:

 http://openejb.apache.org/3.0/jpa-concepts.html

Sorry for the noise.

-- 
Fredrik Jonson