1:1 relations are eager by default.... And eager could be only a loading issue. 
I have a "merge" issue here.

---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de




Am 24.08.2012 um 11:28 schrieb Boblitz John <john.bobl...@bertschi.com>:

> Good Morning,
> 
> I had this often and one solution is to set the FetchType to EAGER for the
> Relationship.
> 
> Cheers,
> 
> John
> 
>> -----Ursprüngliche Nachricht-----
>> Von: Marc Logemann [mailto:m...@logemann.org] 
>> Gesendet: Freitag, 24. August 2012 11:17
>> An: users@openjpa.apache.org
>> Betreff: update null relation on merge()
>> 
>> Hi,
>> 
>> i am facing something like described here:
>> 
>> http://openjpa.208410.n2.nabble.com/null-values-not-updating-t
>> d3224059.html
>> 
>> We get a JSON graph from frontend, let Spring deserialize it 
>> to a java object (with OID set) and want to change the 
>> existing object in the db. This works for simple attribtues 
>> likes Strings and so but not for 1:1 relations. If we set it 
>> to "null" in the frontend, we want to change the 1:1 relation 
>> to null. Instead it leaves the 1:1 relations untouched with 
>> the old object reference in it. 
>> 
>> The OpenJPA docs once said: "When attaching null fields in 
>> these cases, OpenJPA cannot distinguish between a field that 
>> was unloaded and one that was intentionally set to null. In 
>> this case, OpenJPA will use the current detach state setting 
>> to determine how to handle null fields: fields that would 
>> have been included in the detached state are treated as 
>> loaded, and will in turn set the corresponding attached field 
>> to null."
>> 
>> At this point i dont know what to do. Spring knows its 
>> detached because we submit our @Id Field => OID with a valid 
>> and existant value but the merge itself just ignores null 
>> values for 1:1 relations and leaves them as they were. Is 
>> there any sensible way to tell OpenJPA to merge "null" 
>> relations differently?
>> 
>> ---
>> regards
>> Marc Logemann
>> http://www.logemann.org
>> http://www.logentis.de
>> 
>> 
>> 
>> 

Reply via email to