openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From coloradoflyer <open...@parallelsw.com>
Subject Re: null values not updating
Date Sat, 11 Jul 2009 06:05:57 GMT

Hi Daryl,

I added in a 'version' colum to the table, and get/set methods for Version
and annotated it @Version
   @Version
   public int getVersion()
   {
      return _version;
   }
   public void setVersion(int version)
   {
      _version = version;
   }
With these changes, the problem did not change.  I got to thinking that the
problem may be because the class I'm in is decorated with @MappedSuperclass. 
But that was not the issue either, when I moved into the subclass I got the
same results. I did notice that the versions were changing as I updated the
entity, but the null values never seemed to get picked up.


Daryl Stultz wrote:
> 
> On Wed, Jul 8, 2009 at 2:43 AM, coloradoflyer
> <openjpa@parallelsw.com>wrote:
> 
> I have struggled with this problem recently myself. I'm not a JPA expert.
> It
> may be that the problem lies in this line:
> 
>>
>> when I run the following code:
>> ...  the object is disconnected and retrieved from probably another
>> entity
>> manager.
>>   Range r = ....
>>
> 
> I found that if I instantiated an existing entity myself (like from a
> direct
> ResultSet traversal) or I cloned and existing entity I would get this
> problem. The manual states that in this case (I think it was referring to
> deserialization) it can't tell the difference between a null value an an
> "unloaded" field. If you are in fact using an entity manager to get the
> original instance and you don't leave the VM it should have a proper
> detached state. Can you post a simple unit test that shows how you are
> doing
> things?
> 
> -- 
> Daryl Stultz
> _____________________________________
> 6 Degrees Software and Consulting, Inc.
> http://www.6degrees.com
> mailto:daryl@6degrees.com
> 
> 

-- 
View this message in context: http://n2.nabble.com/null-values-not-updating-tp3224059p3241035.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message