openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher Cudennec" <Smutje...@gmx.net>
Subject Re: Auditing: Tests and maps
Date Thu, 22 Dec 2011 09:44:33 GMT
Hi Pinaki,

your proposal led me to the solution. The good news is: I can track the changes by changing
the code the way you proposed.

What puzzled me and made me think that this must be a bug in OpenJPA is the fact that the
field "stringAttributes" was marked as dirty but the Map from the oldState (SaveFieldManager#getState)
contained the modified StringAttribute instance with the new value. It looks like the oldState
does not exactly represent the original state from the time when the object was loaded.

Cheers,

Christopher

-------- Original-Nachricht --------
> Datum: Wed, 21 Dec 2011 09:16:42 -0800 (PST)
> Von: Pinaki Poddar <ppoddar@apache.org>
> An: users@openjpa.apache.org
> Betreff: Re: Auditing: Tests and maps

> Hi Christopher,
> 
>    > a.getStringAttributes().get("key").setValue("new value")); 
> 
>    This line is the culprit (or JPA as a whole is). It is a conceptual
> problem with JPA, in general.
> JPA is managing the field Map<String, StringAttribute> stringAttributes,
> but
> it can not understand that a value in the Map has been directly changed
> underneath. One way will be to rewrite it as:
> 
>    a.getStringAttributes().put("key", new StringAttribute("new value")); 
> 
>   This way a JPA runtime (which has proxied the Map to track changes) will
> become aware that the Map is dirty.
>  
> 
> -----
> Pinaki Poddar
> Chair, Apache OpenJPA Project
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/Auditing-Tests-and-maps-tp7067224p7115915.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.

-- 
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!		
Jetzt informieren: http://www.gmx.net/de/go/freephone

Mime
View raw message