我的网络应用突然不允许人们购买我们的产品。我不知道该怎么办。
昨晚我们的一位工程师不小心@Persistent
从拥有的一对多字段(在父类中)中删除了标签。他在没有对其进行测试的情况下将其上传到 App Engine 服务器。我们收到报告说人们买不到东西,所以我们查看了更改,进入并恢复了@Persistent
标签。
但是现在每次代码尝试修改该字段时都会出现异常。
请帮助-我不知道该怎么做-我们已经添加了@Persistent
注释-为什么会发生这种异常?
@PersistenceCapable
public class Published {
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
@PrimaryKey
private Long id;
...
// see note about this field above
@Persistent(defaultFetchGroup = "true", mappedBy = "pub")
private List<License> licenses;
...
}
@PersistenceCapable
public class License {
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
@PrimaryKey
private Key id;
@Persistent
private Published pub;
...
}
当我创建一个新的 Published 并调用时,会发生以下异常pub.getLicensed().add(new Licensed(...))
Uncaught exception from servlet
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
at org.datanucleus.store.appengine.DatastoreRelationFieldManager.checkForParentSwitch(DatastoreRelationFieldManager.java:203)
at org.datanucleus.store.appengine.DatastoreRelationFieldManager$1.setObjectViaMapping(DatastoreRelationFieldManager.java:134)
at org.datanucleus.store.appengine.DatastoreRelationFieldManager$1.apply(DatastoreRelationFieldManager.java:113)
at org.datanucleus.store.appengine.DatastoreRelationFieldManager.storeRelations(DatastoreRelationFieldManager.java:82)
at org.datanucleus.store.appengine.DatastoreFieldManager.storeRelations(DatastoreFieldManager.java:959)
at org.datanucleus.store.appengine.DatastorePersistenceHandler.storeRelations(DatastorePersistenceHandler.java:585)
at org.datanucleus.store.appengine.DatastorePersistenceHandler.insertPostProcess(DatastorePersistenceHandler.java:320)
at org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObjects(DatastorePersistenceHandler.java:272)
at org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObject(DatastorePersistenceHandler.java:256)
at org.datanucleus.state.JDOStateManagerImpl.internalMakePersistent(JDOStateManagerImpl.java:3185)
at org.datanucleus.state.JDOStateManagerImpl.makePersistent(JDOStateManagerImpl.java:3161)
at org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java:1298)
at org.datanucleus.sco.SCOUtils.validateObjectForWriting(SCOUtils.java:1476)
at org.datanucleus.store.mapped.scostore.ElementContainerStore.validateElementForWriting(ElementContainerStore.java:380)
at org.datanucleus.store.mapped.scostore.FKListStore.validateElementForWriting(FKListStore.java:609)
at org.datanucleus.store.mapped.scostore.FKListStore.internalAdd(FKListStore.java:344)
at org.datanucleus.store.appengine.DatastoreFKListStore.internalAdd(DatastoreFKListStore.java:146)
at org.datanucleus.store.mapped.scostore.AbstractListStore.add(AbstractListStore.java:105)
at org.datanucleus.sco.backed.List.add(List.java:649)
at (my servlet)