Try creating a setter function inside the Foo class itself and set the
array through that function. I'm guessing that the Datanucleus
enhancer isn't finding the update to vals that your using outside the
class. Also, I'd change from using arrays to using a List or Set.

On Nov 12, 11:57 pm, Mark <[email protected]> wrote:
> Hi,
>
> I'm having trouble updating a class which has an array of ints:
>
>   @PersistenceCapable
>   class Foo {
>       @Persistent
>       @Extension(vendorName = "datanucleus", key = "gae.unindexed",
> value="true")
>       int[] vals;
>    }
>
>   ...
>
>   Foo foo = new Foo();
>   foo.vals = new int[] { 1, 2, 3 };
>   pm.makePersistent(foo);
>
> The first time an instance is created, the values are all there ok. If
> I try updating them though, the changes never persist:
>
>   public void updateFoo(PersistenceManagerFactory pmf) {
>       PersistenceManager pm = pmf.getPersistenceManager();
>       Foo foo = pm.getObjectById(Foo.class, myKey);
>       foo.vals[0] = 100;
>       pm.makePersistent(foo);
>   }
>
> I print the values out directly after the call on the foo object
> instance, and the update seems to have worked in memory. However, the
> next time I call updateFoo(), the values are once again starting at
> { 1, 2, 3 }, and not { 100, 2, 3 } as I'm expecting. What am I doing
> wrong?
>
> Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to