[ 
https://issues.apache.org/jira/browse/OPENJPA-2540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vermeulen updated OPENJPA-2540:
-------------------------------
    Attachment: TestEmbeddable.java
                LazyFieldsInEmbeddedEntityTest.java
                Lazy.java
                Inner.java

Added JUnit (4) test case. (Not in the expected format for an official OpenJPA 
unit test but this requires only a few lines.)

> merge without DetachedStateField deletes lazy fields in embedded entities
> -------------------------------------------------------------------------
>
>                 Key: OPENJPA-2540
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2540
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.3.0
>            Reporter: Vermeulen
>         Attachments: Inner.java, Lazy.java, 
> LazyFieldsInEmbeddedEntityTest.java, TestEmbeddable.java
>
>
> I am using the setting <property name="openjpa.DetachState" 
> value="fetch-groups(DetachedStateField=false)" />
> Like the summary says, I have an embedded entity with a field that is lazily 
> fetched. This is a field that is persisted whenever the entity is persisted. 
> (It doesn't matter whether it is a @Basic field or a @ManyToOne relation with 
> cascade = CascadeType.ALL). When I merge a detached entity that has null for 
> such a field, the field is actually made null in the database. The expected 
> behavior is for OpenJPA to notice that the field is null because it was not 
> fetched and ignore it on merge.
> The problem only exists when using an embedded entity together with the 
> DetachedStateField=false setting.
> I created a test case which shows the issue. It is based on that of 
> OPENJPA-1983 which reported a similar issue but whose test case didn't use an 
> embedded entity.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to