Entity version is not updated when the entity is root entity
Closes #17339
This commit is contained in:
parent
b4050b9fa8
commit
d923aa5d5d
1 changed files with 11 additions and 7 deletions
|
@ -47,13 +47,17 @@ public class JpaEntityVersionListener implements PreInsertEventListener, PreDele
|
||||||
*/
|
*/
|
||||||
public void updateEntityVersion(Object entity) throws HibernateException {
|
public void updateEntityVersion(Object entity) throws HibernateException {
|
||||||
Object root = entity;
|
Object root = entity;
|
||||||
while(root instanceof JpaChildEntity) {
|
if (root instanceof JpaChildEntity) {
|
||||||
root = ((JpaChildEntity<?>) entity).getParent();
|
while (root instanceof JpaChildEntity) {
|
||||||
if (root instanceof JpaRootEntity) {
|
root = ((JpaChildEntity<?>) entity).getParent();
|
||||||
if (!((JpaRootEntity) root).updateEntityVersion()) {
|
if (root instanceof JpaRootEntity) {
|
||||||
return;
|
if (!((JpaRootEntity) root).updateEntityVersion()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (root instanceof JpaRootEntity) {
|
||||||
|
((JpaRootEntity) root).updateEntityVersion();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue