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 [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.