She*_*ari 8 java concurrency hibernate jpa
当我在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;
Run Code Online (Sandbox Code Playgroud)
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;
Run Code Online (Sandbox Code Playgroud)
Coordinates.java:
@Embeddable
public class Coordinates {
@NotNull
private int x;
@NotNull
private int y;
@Parent
private Route route;
@Version
private int version;
Run Code Online (Sandbox Code Playgroud)
我为Coordinates和Route生成了Hashcode/equals
检查此JIRA条目.
ConcurrentModificationException当embeddable的集合包含集合时
这是Annotation Binder中的已知错误.而问题在于Hibernate Core,它不支持嵌入式集合中的集合.
归档时间: |
|
查看次数: |
8309 次 |
最近记录: |