openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From No1UNo <je...@jerrycarter.org>
Subject Re: Null field not persisted for Dates
Date Fri, 04 Feb 2011 19:13:58 GMT

Rick:

First of all, thank you very much for the quick response and definitive answer.

Am I right is assuming that null values should be copies on merge?  I've reviewed the JPA
2.0 specification.  I see that 3.2.7.1 does not disadvantage null values
> If X is a detached entity, the state of X is copied onto a pre-existing managed entity
instance X' of the same identity or a new managed copy X' of X is created.

but note that 3.2.7.2 leaves some wiggle room for implementations supporting lazy loading.
 I'm happy to file the report if this is a bug.

I see that FetchType.EAGER is already specified (by default), so lazy loading is already turned
off for the field in question.  Do I understand that (post-merge), setting the value to null
should cause the value to be persisted?

Thanks.

-=- Jerry


On Feb 4, 2011, at 1:56 PM, Rick Curtis [via OpenJPA] wrote:

> Jerry - 
> 
> That would be the problem then. We lost track of the fact that you set this 
> field to null, and assume that it wasn't loaded.  Please review the 
> openjpa.DetachState [1] docs for more info. You could set the property 
> listed below so that we will stream our DetachedStateManager around. 
> 
> <property name="openjpa.DetachState" 
> value="fetch-groups(DetachedStateField=true)"/> 
> 
> [1] 
> http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_detach_graph
> 
> Thanks, 
> Rick 
> 
> On Fri, Feb 4, 2011 at 12:49 PM, No1UNo <[hidden email]> wrote: 
> 
> > 
> > Yes, it is.  The object is changed remotely and then merged.  The data on 
> > the wire is fine. 
> > 
> > On Feb 4, 2011, at 1:47 PM, Rick Curtis [via OpenJPA] wrote: 
> > 
> > > Jerry - 
> > > 
> > > Is the Entity which you are trying to update being 
> > serialized/deserialized? 
> > > 
> > > Thanks, 
> > > Rick 
> > > 
> > > On Fri, Feb 4, 2011 at 12:25 PM, Jerry Carter <[hidden email]> wrote:

> > > 
> > > > Using OpenJPA 2.0.1, I have a date field in my entity.  Setting the 
> > field 
> > > > to a non-null value causes the data to be persisted as one would 
> > expect. 
> > > >  Setting the value to null, however, does not trigger an UPDATE 
> > operation. 
> > > >  I'm still digging, but I'm sure that someone else has encountered 
> > this. 
> > > > 
> > > > FWIW, the annotations for the field are simple: 
> > > > 
> > > > @Temporal(TemporalType.DATE) 
> > > > @Column(name="purchase_date" private Date purchaseDate; 
> > > > 
> > > > I do not specify 'nullable', but it defaults to true and the field 
> > supports 
> > > > a NULL value in the database. 
> > > > 
> > > > -=- Jerry 
> > 
> 
> 
> If you reply to this email, your message will be added to the discussion below:
> http://openjpa.208410.n2.nabble.com/Null-field-not-persisted-for-Dates-tp5993519p5993617.html
> To start a new topic under OpenJPA Users, email ml-node+208411-1703014788-244680@n2.nabble.com

> To unsubscribe from OpenJPA Users, click here.


-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Null-field-not-persisted-for-Dates-tp5993519p5993681.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message