Are you able to store a HashMap within an embedded class on App Engine? I have the following Class:
@Persistent(serialized = "true")
@Embedded
private Stats stats;
@PersistenceCapable
@EmbeddedOnly
public static class Stats implements Serializable {
    private static final long serialVersionUID = 1L;        
    @Persistent(serialized = "true", defaultFetchGroup="true")
    private Map<String, Integer> requests;
    public Stats() {
        requests = 开发者_运维问答new HashMap<String, Integer>();
    }
}
However, when I attempt to add an item to the HashMap and persist it I get the following error:
Specified class class com.google.appengine.api.datastore.Blob is not persistable
I know you can successfully use a HashMap in a "normal" class but can they be used in embedded Class's also?
Thanks
I haven't tried it with an Embedded class, but my Maps inside JDO objects needed additional FetchGroup annotations on the containing class...
    @SuppressWarnings("serial
        ")
        @PersistenceCapable(identityType=IdentityType.APPLICATION, detachable="true")
        @FetchGroup(name="QueryAggregationJobJDO", members={
                                                @Persistent(name="appName", recursionDepth=-1),
etc....                                         
        public class QueryAggregationJobJDO extends AggregationJobJDO implements SystemObject {
            @Persistent(serialized="true")  // this is string of app names and a count for each name found
            public Map< String, Long >  appName = new HashMap<String, Long>();
and we had to add this class with getFetchPlan() when opening our DataManager...
@Override
public boolean open() {
    DataAreaManager dataAreaManager = new DataAreaManager();
    dataAreaManager.setDataArea(VERSION_DATA_AREA);
    if ((pm == null) || (pm.isClosed())) {
        pm = PMF.get(type).getPersistenceManager();
        pm.getFetchPlan().addGroup("TouchActiveUserJDO");
        pm.getFetchPlan().addGroup("UserRoleJDO");
        pm.getFetchPlan().addGroup("QueryAggregationJobJDO");
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论