a side note: it works if I use 
<property name="openjpa.DetachState" value="fetch-groups"/>

But it looks most likely as a bug to me because I don't serialize the detached 
entity, nor do I invoke native queries to get it, etc - just plain JPA! So it 
must give me exactly the same results regardless of the detach strategy I use...

Should I file a JIRA?

LieGrue,
strub

--- On Fri, 11/26/10, Mark Struberg <strub...@yahoo.de> wrote:

> From: Mark Struberg <strub...@yahoo.de>
> Subject: AttachStrategy Question
> To: dev@openjpa.apache.org
> Date: Friday, November 26, 2010, 4:54 PM
> Hi folks!
> 
> I have a question regarding OpenJPA-2.0.1 AttachStrategy
> DETACH_LOADED.
> 
> I have an entity with a Date field. This field gets filled
> with the current date and stored to the database. Afterwards
> it gets loaded from the database and detached. In the next
> request the date will be reset to null. And here comes the
> problem (around AttachStrategy#178):
> 
> 
>             case
> JavaTypes.OBJECT:
>             case
> JavaTypes.OID:
>             case
> JavaTypes.ENUM:
>                 val
> = fetchObjectField(i);
> --->            if (val ==
> null && !nullLoaded) <-- problem
>                
>     return false;
>                
> sm.settingObjectField(into, i, sm.fetchObjectField(i), val,
>                
>     set);
>                
> break;
> 
> This leads to not getting the date field reset to null in
> the database while merging the entity.
> 
> Imo this should only be skipped if the field didn't got
> loaded previously from the database. I bet this information
> is available, but where can I get this information from?
> 
> Are some bells ringing, or should I try to craft a unit
> test?
> 
> txs and LieGrue,
> strub
> 
> 
> 
>       
> 



Reply via email to