我正在使用Eclipselink 2.5 我正在讨论3个实体关系。 Review_Group,Review和Artifact。场景是我创建一个Review_Group然后我创建一个Review然后一个Artifact,现在我去更新我的Review_Group并添加一些用户作为组的成员它创建用户并添加成员但它也更新了审查表并删除了Review_Group并更新工件表并删除审阅ID
工件可以是任何人Review_Group或Review的一部分 从 Review_Group 到Review和Artifact
的关系@OneToMany(mappedBy = "reviewGroup", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
Set<Review> Reviews;
@OneToMany(mappedBy = "ReviewGroup", cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true)
Set<Artifact> Artifacts;
从审核到Review_Group和Artifact
的关系@ManyToOne(fetch = FetchType.LAZY, optional = true, cascade = { CascadeType.REFRESH, CascadeType.MERGE })
@JoinColumn(name = "REVIEW_GROUP_ID", referencedColumnName = "UUID")
@XmlIDREF
Review_Group reviewGroup;
@OneToMany(mappedBy = "Review", fetch = FetchType.LAZY, orphanRemoval = true, cascade = ALL)
Set<Artifact> artifacts;
从工件到Review and ReviewGroup
的反向关系@ManyToOne(fetch = FetchType.LAZY, optional = true, cascade = { CascadeType.REFRESH, CascadeType.MERGE })
@JoinColumn(name = "REVIEW_ID", referencedColumnName = "UUID")
@XmlIDREF
Review Review;
@ManyToOne(fetch = FetchType.LAZY, optional = true, cascade = { CascadeType.REFRESH, CascadeType.MERGE })
@JoinColumn(name = "REVIEW_GROUP_ID", referencedColumnName = "UUID")
@XmlIDREF
Review_Group ReviewGroup;
这里是审核和review_group,关系的所有者是review_group所以我不认为合并和刷新反面有任何影响。但即使我删除它们也会产生相同的结果。同样适用于审查和工件
查询beginTransaction()和commitTransaction()
之间的日志[EL Fine]: sql: 2014-06-24 14:21:25.689--ServerSession(-1435943142)--Connection(-1128697476)--Thread(Thread[Default Executor-thread-9,5,Default Executor Thread Group])--SELECT UUID
, ADMIN, ARCHIVED, EMAIL_ADDRESS, NAME FROM TR_USER.USER WHERE (UUID = ?)
bind => [_7lJuKiNMIBy_7iKNF2lYXA]
[EL Fine]: sql: 2014-06-24 14:21:34.728--ClientSession(15550695)--Connection(-1128697476)--Thread(Thread[Default Executor-thread-9,5,Default Executor Thread Group])--INSERT INTO TR _USER.USER (UUID, ADMIN, ARCHIVED, EMAIL_ADDRESS, NAME) VALUES (?, ?, ?, ?, ?)
bind => [_7lJuKiNMIBy_7iKNF2lYXA, false, false, sdwtest1@in.ibm.com, Sdwb Sdwbtest1]
[EL Fine]: sql: 2014-06-24 14:21:34.822--ClientSession(15550695)--Connection(-1128697476)--Thread(Thread[Default Executor-thread-9,5,Default Executor Thread Group])--**INSERT INTO TR
_REVIEW.JOIN_MEMBER_REVIEW_GROUP (REVIEW_GROUP_ID, ROLE_ID, USER_ID) VALUES (?, ?, ?)
bind => [_k5ThbW1zI3eSnLMSL8PgHQ, _WqvkV8D7FJ9hWnkyK4AVZA, _7lJuKiNMIBy_7iKNF2lYXA]**
[EL Fine]: sql: 2014-06-24 14:21:34.926--ClientSession(15550695)--Connection(-1128697476)--Thread(Thread[Default Executor-thread-9,5,Default Executor Thread Group])--**UPDATE TR_REVI
EW.REVIEW SET REVIEW_GROUP_ID = ? WHERE (UUID = ?)
bind => [null, _0AGl3gccGy5fKYnekgucXw]**
[EL Fine]: sql: 2014-06-24 14:21:35.055--ClientSession(15550695)--Connection(-1128697476)--Thread(Thread[Default Executor-thread-9,5,Default Executor Thread Group])--**UPDATE TR_REVI
EW.ARTIFACT SET AUTHOR_ID = ?, REVIEW_ID = ?, ATTACHMENT_ID = ? WHERE (UUID = ?)
bind => [null, null, null, _GihmSx7PHUifNQeazRA37g]**
[EL Fine]: sql: 2014-06-24 14:21:35.202--ClientSession(15550695)--Connection(-1128697476)--Thread(Thread[Default Executor-thread-9,5,Default Executor Thread Group])--DELETE FROM TR
_REVIEW.ATTACHMENT WHERE (UUID = ?)
bind => [_eHmknAKvIK9uiGI1VOfWyQ]
提前致谢,我们非常感谢任何帮助