小编典典

CollectionOfElements上的java.util.ConcurrentModificationException

hibernate

当我在Embedabble中有一个CollectionOfElements时,我似乎得到了ConcurrentModificationException。

如果想要这样,但是如果我将Route从Embedabble更改为Entity,则一切正常。我什至尝试添加@Version,但这似乎不起作用。

这是我班的摘录。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:

@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:

@Embeddable
public class Coordinates {

@NotNull
private int x;

@NotNull
private int y;

@Parent
private Route route;

@Version
private int version;

我已经为坐标和路线生成哈希码/等于


阅读 320

收藏
2020-06-20

共1个答案

小编典典

检查此JIRA条目。

ConcurrentModificationException当可嵌入的集合包含一个集合时

这是Annotation Binder中的一个已知错误。问题出在Hibernate Core上,它不支持嵌入式集合中的集合。

2020-06-20