[appengine-java] Re: Sometimes arraylist stored in Datastore are not correctly retrieved

2011-06-09 Thread Nathan Stiles
I have almost 0 experience I'm just reading to learn a bit.  It seems rather 
ambitious to store an ArrayList?  Maybe modifying your "tags" to be an array 
would be more successful.  You could probably keep your g/setters and modify 
them slightly.  Then you have to convert exiting datastores.  I don't know. 
 I'll be interested to see what you discover either way.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/NwXCHDp2WZIJ.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Sometimes arraylist stored in Datastore are not correctly retrieved

2011-06-09 Thread yuvi
Hi,

My declarations are a bit different but I have seen this
happening 

GAE not loading the subitems by default in some cases, then if you
close the PersistenceManager, subitems List is null.
I have solved it by looping all items and subitems before closing the
PersistenceManager




On Jun 9, 4:05 am, cghersi  wrote:
> Hi all,
>
> I've got an issue with a property with type ArrayList.
>
> Let's suppose I've got a class like this:
>
> @PersistenceCapable(identityType = IdentityType.APPLICATION,
> detachable = "true")
> @Inheritance(strategy=InheritanceStrategy.SUBCLASS_TABLE)
> public class CommContact implements Serializable {
>     @PrimaryKey
>     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>     protected Long idCont;
>
>         @Persistent(defaultFetchGroup="true")
>         protected ArrayList tags;
>
>      // other properties
>
> }
>
> And another class DBContact that extends CommContact, like this:
> @PersistenceCapable(identityType = IdentityType.APPLICATION,
> detachable = "true")
> public class DBContact extends CommContact {
> // some other properties...
>
> }
>
> Now, let's suppose that I do a query on datastore and I retrieve a
> DBContact object. Sometimes (I cannot understand which is the pattern
> for this issue...) the property "tags" is not correctly valued,
> resulting in an empty array (but if I go to the DataViewer, I can
> actually see that on the datastore some tags exist for this DBContact
> object...).
>
> What am I missing?
>
> I really cannot understand why sometimes it works and sometimes not...
>
> Thank you very much!
>
> Bye
> cghersi

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Sometimes arraylist stored in Datastore are not correctly retrieved

2011-06-10 Thread cghersi
@Nathan: I use ArrayList for a bounch of other properties in several
other objects, and usually they are completely OK...

On 10 Giu, 05:31, Nathan Stiles  wrote:
> I have almost 0 experience I'm just reading to learn a bit.  It seems rather
> ambitious to store an ArrayList?  Maybe modifying your "tags" to be an array
> would be more successful.  You could probably keep your g/setters and modify
> them slightly.  Then you have to convert exiting datastores.  I don't know.
>  I'll be interested to see what you discover either way.

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Sometimes arraylist stored in Datastore are not correctly retrieved

2011-06-10 Thread cghersi
OK, thanks, I'll try with this trick...

Bye cghersi

On 10 Giu, 06:22, yuvi  wrote:
> Hi,
>
> My declarations are a bit different but I have seen this
> happening 
>
> GAE not loading the subitems by default in some cases, then if you
> close the PersistenceManager, subitems List is null.
> I have solved it by looping all items and subitems before closing the
> PersistenceManager
>
> On Jun 9, 4:05 am, cghersi  wrote:
>
>
>
>
>
>
>
> > Hi all,
>
> > I've got an issue with a property with type ArrayList.
>
> > Let's suppose I've got a class like this:
>
> > @PersistenceCapable(identityType = IdentityType.APPLICATION,
> > detachable = "true")
> > @Inheritance(strategy=InheritanceStrategy.SUBCLASS_TABLE)
> > public class CommContact implements Serializable {
> >     @PrimaryKey
> >     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> >     protected Long idCont;
>
> >         @Persistent(defaultFetchGroup="true")
> >         protected ArrayList tags;
>
> >      // other properties
>
> > }
>
> > And another class DBContact that extends CommContact, like this:
> > @PersistenceCapable(identityType = IdentityType.APPLICATION,
> > detachable = "true")
> > public class DBContact extends CommContact {
> > // some other properties...
>
> > }
>
> > Now, let's suppose that I do a query on datastore and I retrieve a
> > DBContact object. Sometimes (I cannot understand which is the pattern
> > for this issue...) the property "tags" is not correctly valued,
> > resulting in an empty array (but if I go to the DataViewer, I can
> > actually see that on the datastore some tags exist for this DBContact
> > object...).
>
> > What am I missing?
>
> > I really cannot understand why sometimes it works and sometimes not...
>
> > Thank you very much!
>
> > Bye
> > cghersi

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Sometimes arraylist stored in Datastore are not correctly retrieved

2011-06-10 Thread Nathan Stiles
That's really cool and flexible.  I'm quite impressed.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/OYvt6ELYLVUJ.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.