Thanks Max, that solves it.

The datastore viewer in development console kind of misled me to think
the field is not persisted at all. I have noticed that after adding
records with the serialized field set, the serialized field column is
not shown in the datastore viewer. But, as soon as I add one record
with the serialized field == null, the column is shown in the
datastore viewer.

Could this be a bug or there is something more that I am missing?


On Feb 26, 12:28 pm, Max <thebb...@gmail.com> wrote:
> how about defaultFetchGroup = "true" ?
>
> On Feb 25, 9:18 pm, Arnold <arnold.mi...@gmail.com> wrote:
>
>
>
> > Two classes are defined:
> > ----------------------------------
> > @PersistenceCapable(identityType=IdentityType.DATASTORE,
> > detachable="true")
> > public class TestSerialized {
>
> >         @Persistent
> >         private String nonSerialized;
> >         @PrimaryKey() 
> > @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
> >         private Key primaryKey;
>
> >         @Persistent @Serialized
> >         private SerializedObj serializedObj;
>
> > }
>
> > public class SerializedObj implements Serializable{
> >         /**
> >          *
> >          */
> >         private static final long serialVersionUID = 6258869487732411716L;
> >         private String value;
>
> >         public SerializedObj() {
> >         }
> >         public SerializedObj(String value) {
> >                 this.value = value;
> >         }
>
> > }
>
> > ----------------------------------
>
> > When a TestSerialized  is persisted like below, the nonSerialized
> > field works fine but the serializedObj field is not saved to the
> > datastore, and looking into the development console, the field/column
> > is not even created:
>
> >                 PersistenceManager pm = PMF.get().getPersistenceManager();
> >                 try{
> >                         pm.currentTransaction().begin();
> >                         TestSerialized draft = new TestSerialized();
> >                         draft.setSerializedObj(new SerializedObj("dd"));
> >                         pm.makePersistent(draft);
> >                         pm.currentTransaction().commit();
> >                 }finally{
> >                         if(pm.currentTransaction().isActive()){
> >                                 pm.currentTransaction().rollback();
> >                         }
> >                         pm.close();
> >                 }
>
> > @Persistent(serialized="true") didn't help either.
>
> > Am I missing something?
>
> > I am using SDK 1.3.1 .
>
> > 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 google-appengine-j...@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.

Reply via email to