org.datanucleus.sco.backed.ArrayList不能转换为java.util.Set [英] org.datanucleus.sco.backed.ArrayList cannot be cast to java.util.Set
问题描述
自4天前,在随机短时间内,我部署的应用程序抛出这个错误:
Since 4 days ago, in random short periods of time, my deployed application is throwing this error:
org.datanucleus.sco.backed.ArrayList不能转换为java.util.Set
org.datanucleus.sco.backed.ArrayList cannot be cast to java.util.Set
我们正在使用GWT 2.4 / Java 1.7(我们最近从1.6迁移到1.7)
We are using GWT 2.4 / Java 1.7 (We recently migrate from 1.6 to 1.7)
它在检索或持久保存带有字符串集的实体时发生:
It happens when retrieving or persisting an entity with a String set:
import java.util.HashSet;
import java.util.Set;
...
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
public class DbAccount {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
...
@Persistent
private Set<String> accounts;
...
public DbAccount(SerAccount account) throws Exception {
...
this.accounts= new HashSet<String>();
...
key = KeyFactory.createKey(DbCuentas.class.getSimpleName(), this.id);
}
}
我已经检查过整个项目, strong> org.datanucleus.sco.backed.ArrayList ,它不存在。
I have checked my entire project for a reference to org.datanucleus.sco.backed.ArrayList and it does not exist.
有什么想法?
推荐答案
这可能听起来很愚蠢,但是您是否尝试过使用 List
而不是 Set
?
It may sound stupid, but have you tried to use List
instead of Set
?
再次检出文档后,我找不到Google提供的任何示例,并带有集合
> 列表
。
After checking out the docs again, I can't find any example from Google with a Collection
other than List
.
阅读你的问题,它看起来像无论你做什么,JPA datanucleus impl都在使用他们自己的ArrayList实现。我不知道为什么这个问题会随机发生......
Reading your issue, it looks like the JPA datanucleus impl is indeed using their own ArrayList implementation whatever you do. I don't know why the problem happens randomly though...
这篇关于org.datanucleus.sco.backed.ArrayList不能转换为java.util.Set的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!