CollectionOfElements上的java.util.ConcurrentModificationException [英] java.util.ConcurrentModificationException on CollectionOfElements
问题描述
当我在Embedabble中有一个CollectionOfElements时,我似乎得到了一个ConcurrentModificationException。
I seem to get a ConcurrentModificationException when I have a CollectionOfElements inside an Embedabble.
如果希望这样,如果我将Route从Embedabble改为实体比一切工作正常。我甚至尝试添加@Version,但是这似乎不工作。
If would like to have it like that, however If I change Route from Embedabble's to Entity than everything works fine. I have even tried adding @Version, but that doesn't seem to work.
这里是我的类的一个片段。
Kart.java:
Here are a snippet of my classes. Kart.java:
@Entity
public class Kart {
@Id @GeneratedValue
private Long id;
@Column(nullable=false,length=256)
@NotNull
@Length(max=256)
private String name;
@OneToOne(cascade=CascadeType.ALL)
private File file;
@Version
private int version;
@CollectionOfElements
private Set<Route> route;
Route.java:
Route.java:
@Embeddable
public class Route {
@Parent
private Kart kart;
@NotNull
@Column(nullable = false, length = 256)
private String name;
@NotNull
@Column(nullable = false)
private Boolean visible = Boolean.valueOf(true);
@CollectionOfElements
private Set<Coordinates> coordinates;
@Version
private int version;
Coordinates.java:
Coordinates.java:
@Embeddable
public class Coordinates {
@NotNull
private int x;
@NotNull
private int y;
@Parent
private Route route;
@Version
private int version;
我已经为坐标和路线生成了Hashcode / equals
推荐答案
检查此JIRA条目。
Check this JIRA entry.
ConcurrentModificationException当嵌入的集合包含集合
这是Annotation Binder中的一个已知错误。问题在于Hibernate Core,它不支持嵌入式集合中的集合。
It's a known bug in the Annotation Binder. And the issue lies in Hibernate Core which doesn't support collections in collections of embedded.
这篇关于CollectionOfElements上的java.util.ConcurrentModificationException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!