当我尝试保留二维 ArrayList 时,出现以下错误:
java.lang.IllegalArgumentException: cng_content: java.util.ArrayList is not a supported property type.
我正在使用两个数组列表构建矩阵的表示并尝试将其持久化到数据存储中。
Key cngKey = KeyFactory.createKey("CNG", jsonCNG.cNGID);
Entity cngEntity = new Entity("CNG", cngKey);
cngEntity.setProperty("cng_name", jsonCNG.cNGName);
cngEntity.setProperty("cng_type", jsonCNG.cNGType);
cngEntity.setProperty("cng_content", cng);
在代码片段中 cng 的类型是:
ArrayList<ArrayList<String>>
我最初使用
ArrayList<HashMap<Byte,Boolean>>
作为对象的类型。但是,发现 GAE 数据存储不支持 HashMap。此外,我不打算查询存储的对象。只是为了存储和检索它们。