[ https://issues.apache.org/jira/browse/OPENJPA-2536?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rick Curtis updated OPENJPA-2536: --------------------------------- Attachment: (was: OPENJPA-2536.fix.patch) > FetchGroup is not returning lazy fields. > ---------------------------------------- > > Key: OPENJPA-2536 > URL: https://issues.apache.org/jira/browse/OPENJPA-2536 > Project: OpenJPA > Issue Type: Bug > Components: kernel > Affects Versions: 2.1.2, 2.2.1.1, 2.2.3, 2.3.0, 2.4.0 > Reporter: Heath Thomann > Assignee: Rick Curtis > Priority: Minor > > I have found an issue with FetchGroups not returning 'lazy' fields. To > describe, take this entity: > @Entity > @FetchGroup(name = "HardwareSimple", attributes = { @FetchAttribute(name = > "status"), > @FetchAttribute(name = "statusActive") }) > public class HardwareStatus implements Serializable { > @Id > private String status; > private String statusActive; > private String condition; > private int connection; > ............... > With this Entity, take the following scenario: > OpenJPAEntityManager openJpaEm = OpenJPAPersistence.cast(em); > openJpaEm.getFetchPlan().resetFetchGroups().removeFetchGroup("default").addFetchGroups("HardwareSimple"); > HardwareStatus h1 = em.find(HardwareStatus.class, "Lost"); > //h1.status contains "Lost" in the db. > assertEquals("Lost",h1.getStatus()); //this assert passes > //h1.connection contains '2' in the db. > assertEquals(2, h1.getConnection()); //this assert fails, 0 is returned by > the getter. > //h1.condition contains "Used" in the db. > assertEquals("Used", h1.getCondition()); //this assert fails, null is > returned by the getter. > The latter two h1.get* do not return the correct values. These fields are > 'lazy' (i.e. not part of the FetchGroup) but should be fetched when > requested. See the attached test for full details. > Thanks, > Heath -- This message was sent by Atlassian JIRA (v6.3.4#6332)