openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harald Wellmann (JIRA)" <>
Subject [jira] Created: (OPENJPA-1784) Map value updates not flushed
Date Wed, 08 Sep 2010 13:31:32 GMT
Map value updates not flushed

                 Key: OPENJPA-1784
             Project: OpenJPA
          Issue Type: Bug
          Components: jdbc
    Affects Versions: 2.0.1
            Reporter: Harald Wellmann

I have an entity with a map element collection where the map value is an Embeddable.

public class LocalizedString {

    private String language;
    private String string;

    // getters and setters omitted


public class MultilingualString {

    private long id;

    private Map<String, LocalizedString> map = new HashMap<String, LocalizedString>();

Given a persistent instance m of my entity, I update a member of a given map value and then
merge the modified entity:

    EntityManager em = ...;
The problem is, the state change of the map does not get saved to the database. With DEBUG
logging on, I can see that the flush on commit does not trigger any SQL UPDATE.

To force the update, I have to put a new value into the map instead of just changing the existing

    EntityManager em = ...;
    m.getMap().put("en"), new LocalizedString("en", "foo"));

After this change, I do see the expected UPDATE.

My Embeddable does have hashCode() and equals() implemented such that the changed map is not
equal() to the former version in either case.

This looks like a bug in the dirty-checking logic in OpenJPA.

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

View raw message