Chris- You may want to try adding a @Version field to your Entity.
-Rick On Wed, Jul 8, 2009 at 1:43 AM, coloradoflyer <[email protected]>wrote: > > Hi all, > > I'm working on a very simple setting from > openejb(3.1)/openjpa(1.2.1)/Postgres-8.3 > > I can retrieve a persistent object without problem, but if I attempt to > update a column to null, the value is not set. > > The object basically has a min and max (Long) values. > > Here is my abbreviated mapping: > Range { > Long min; > Long max; > > @Column(name="min", nullable=true, updatable=true, insertable=true) > Long getMin() { return min;} > void setMin(Long a) { min=a;} > > @Column(name="max", nullable=true, updatable=true, insertable=true) > Long getMax() { return max;} > void setMax(Long a) { max=a;} > } > > when I run the following code: > ... the object is disconnected and retrieved from probably another entity > manager. > Range r = .... > r.setMin(null); > entityManager.merge(r); > > The update does not happen. But, if I update setMin(1) the update does > take > place. > > However if I run the following code things seem to behave: > Range r = ... > Range newRangeInThisTransaction = entityManager.find(Range.class, > r.getID()); > newRangeInThisTransation.setMin(r.getMin()); > newRangeInThisTransaction.setMax(r.getMax()); > entityManager.merge(newRangeInThisTransaction); > > any help would be greatly appreciated... If the problem is not obvious, I > will work on a small working example to show the problem. > > -chris > -- > View this message in context: > http://n2.nabble.com/null-values-not-updating-tp3224059p3224059.html > Sent from the OpenJPA Users mailing list archive at Nabble.com. >
