org.datanucleus.sco.backed.ArrayList 不能转换为 java.util.Set [英] org.datanucleus.sco.backed.ArrayList cannot be cast to java.util.Set

查看:30
本文介绍了org.datanucleus.sco.backed.ArrayList 不能转换为 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);
    }
}

我已经检查了我的整个项目以获取对 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 ?

再次查看文档后,除了 List 之外,我找不到任何带有 Collection 的 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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆