[ 
https://issues.apache.org/jira/browse/OPENJPA-316?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12542891
 ] 

Patrick Linskey commented on OPENJPA-316:
-----------------------------------------

FTR, this is happening because in a Java 5 vm without a javaagent, OpenJPA 
cannot intercept field accesses, so fields that are not eagerly loaded are not 
available. The docs indicate that this is only an issue for one-to-one and 
many-to-one, but it turns out it's also an issue for collections and maps.

This can be worked around by running java like so:

    java -javaagent:path/to/openjpa.jar=RuntimeEnhancement=false

Of course, if you left the runtime enhnacement on, the problem would also not 
occur, but that would incur the classload penalties associated with 
javaagent-based enhancement. When RuntimeEnhancement is set to false, the 
javaagent just registers an Instrumentation so that OpenJPA can redefine 
classes on demand in a Java 5 environment.

> Unenhanced OneToMany collection not loaded
> ------------------------------------------
>
>                 Key: OPENJPA-316
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-316
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: Dain Sundstrom
>             Fix For: 1.0.2, 1.1.0
>
>         Attachments: OPENJPA-316.patch
>
>
> Unenhanced OneToMany fields are not loaded when using a new entity manager.  
> The fields appear to work when reusing a resource local em across multiple 
> transactions, but when a new em is created the OneToMany field will be null.
> Attached is a test case that reproduces this problem.  The test method has 
> been disabled so the build will not break.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to