[JIRA] (HHH-15480) Merging of ModWorkUnit with CollectionChangeWorkUnit followed by another ModWorkUnit leads to lost modified flags
by Artёm Basov (JIRA)
Artёm Basov ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *updated* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZWRiNmU5ZjE5... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-15480?atlOrigin=eyJpIjoiZWRiNm... ) HHH-15480 ( https://hibernate.atlassian.net/browse/HHH-15480?atlOrigin=eyJpIjoiZWRiNm... ) Merging of ModWorkUnit with CollectionChangeWorkUnit followed by another ModWorkUnit leads to lost modified flags ( https://hibernate.atlassian.net/browse/HHH-15480?atlOrigin=eyJpIjoiZWRiNm... )
Change By: Artёm Basov ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
This is, in a sense, a combination of [HHH-7918|https://hibernate.atlassian.net/browse/HHH-7918] and [HHH-7948|https://hibernate.atlassian.net/browse/HHH-7948].
Steps:
# Tx1: Create {{ListRefEdEntity}}
# Tx2:
## Fetch {{ListRefEdEntity}} created at (1)
## Create and persist {{ListRefIngEntity}} associated with {{ListRefEdEntity}} fetched at (a)
## Change its data , associate with {{ListRefIngEntity}}
## Flush
## Change its data again
This will lead to 2nd revision of {{ListRefEdEntity}} with {{reffering_mod=false}}
See a [PR|https://github.com/hibernate/hibernate-orm/pull/5253] with a test case.
We’ve caught this in {{5.4.32}}, but since test case fails on {{main}}, I’m assuming it affects every version since {{5.4.32}}
The way I see the problem is that by discarding both {{CollectionChangeWorkUnit}} and {{ModWorkUnit#data}} that contain calculated {{*_MOD}} flags, we are relying on the difference between {{oldState}} and {{newState}}, but debug shows that both states already contain added {{ListRefIngEntity}}, so comparing those gives us {{false}}.
From what I see, {{FlushEntityEvent}} is created with the entities state from {{PersistentContext}} and it differs from what it is in DB.
If we can’t rely Any ideas on the difference between the states, I guess our only option is to store {{CollectionChangeWorkUnits}} inside {{ModWorkUnit}} and apply those right before execution. Am I wrong or missing something how it might be fixed ?
( https://hibernate.atlassian.net/browse/HHH-15480#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-15480#add-comment?atlOrigin=ey... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100206- sha1:3ac329d )
2 years, 6 months
[JIRA] (HHH-15480) Merging of ModWorkUnit with CollectionChangeWorkUnit followed by another ModWorkUnit leads to lost modified flags
by Artёm Basov (JIRA)
Artёm Basov ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *updated* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNGZkNjhiYmMz... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-15480?atlOrigin=eyJpIjoiNGZkNj... ) HHH-15480 ( https://hibernate.atlassian.net/browse/HHH-15480?atlOrigin=eyJpIjoiNGZkNj... ) Merging of ModWorkUnit with CollectionChangeWorkUnit followed by another ModWorkUnit leads to lost modified flags ( https://hibernate.atlassian.net/browse/HHH-15480?atlOrigin=eyJpIjoiNGZkNj... )
Change By: Artёm Basov ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
This is, in a sense, a combination of [HHH-7918|https://hibernate.atlassian.net/browse/HHH-7918] and [HHH-7948|https://hibernate.atlassian.net/browse/HHH-7948].
Steps:
# Tx1: Create {{ListRefEdEntity}}
# Tx2:
## Fetch {{ListRefEdEntity}} created at (1)
## Create and persist {{ListRefIngEntity}} associated with {{ListRefEdEntity}} fetched at (a)
## Change its data , associate with {{ListRefIngEntity}}
## Flush
## Change its data again
This will lead to 2nd revision of {{ListRefEdEntity}} with {{reffering_mod=false}}
See a [PR|https://github.com/hibernate/hibernate-orm/pull/5253] for with a test case.
We’ve caught this in {{5.4.32}}, but since test case fails on {{main}}, I’m assuming it affects every version since {{5.4.32}}
The way I see the problem is that by discarding both {{CollectionChangeWorkUnit}} and {{ModWorkUnit#data}} that contain calculated {{*_MOD}} flags, we are relying on the difference between {{oldState}} and {{newState}}, but debug shows that both states already contain added {{ListRefIngEntity}}, so comparing those gives us {{false}}.
From what I see, {{FlushEntityEvent}} is created with the entities state from {{PersistentContext}} and it differs from what it is in DB.
If we can’t rely on the difference between the states, I guess our only option is to store {{CollectionChangeWorkUnits}} inside {{ModWorkUnit}} and apply those right before execution. Am I wrong or missing something?
( https://hibernate.atlassian.net/browse/HHH-15480#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-15480#add-comment?atlOrigin=ey... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100206- sha1:3ac329d )
2 years, 6 months
[JIRA] (HHH-15480) Merging of ModWorkUnit with CollectionChangeWorkUnit followed by another ModWorkUnit leads to lost modified flags
by Artёm Basov (JIRA)
Artёm Basov ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *updated* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYzRlODFmNTAy... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-15480?atlOrigin=eyJpIjoiYzRlOD... ) HHH-15480 ( https://hibernate.atlassian.net/browse/HHH-15480?atlOrigin=eyJpIjoiYzRlOD... ) Merging of ModWorkUnit with CollectionChangeWorkUnit followed by another ModWorkUnit leads to lost modified flags ( https://hibernate.atlassian.net/browse/HHH-15480?atlOrigin=eyJpIjoiYzRlOD... )
Change By: Artёm Basov ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
This is, in a sense, a combination of [HHH-7918|https://hibernate.atlassian.net/browse/HHH-7918] and [HHH-7948|https://hibernate.atlassian.net/browse/HHH-7948].
Steps:
# Tx1: Create {{ListRefEdEntity}}
# Tx2:
## Fetch {{ListRefEdEntity}} created at (1)
## Create and persist {{ListRefIngEntity}} associated with {{ListRefEdEntity}} fetched at (a)
## Change its data , associate with {{ListRefIngEntity}}
## Flush
## Change its data again
This will lead to 2nd revision of {{ListRefEdEntity}} with {{reffering_mod=false}}
See a [PR|https://github.com/hibernate/hibernate-orm/pull/5253] for a test case.
We’ve caught this in {{5.4.32}}, but since test case fails on {{main}}, I’m assuming it affects every version since {{5.4.32}}
The way I see the problem is that by discarding both {{CollectionChangeWorkUnit}} and {{ModWorkUnit#data}} that contain calculated {{*_MOD}} flags, we are relying on the difference between {{oldState}} and {{newState}}, but debug shows that both states already contain added {{ListRefIngEntity}}, so comparing those gives us {{false}}.
From what I see, {{FlushEntityEvent}} is created with the entities state from {{PersistentContext}} and it differs from what it is in DB.
If we can’t rely on the difference between the states, I guess our only option is to store {{CollectionChangeWorkUnits}} inside {{ModWorkUnit}} and apply those right before execution. Am I wrong or missing something?
( https://hibernate.atlassian.net/browse/HHH-15480#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-15480#add-comment?atlOrigin=ey... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100206- sha1:3ac329d )
2 years, 6 months
[JIRA] (HHH-15480) Merging of ModWorkUnit with CollectionChangeWorkUnit followed by another ModWorkUnit leads to lost modified flags
by Artёm Basov (JIRA)
Artёm Basov ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *updated* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMDQ0M2M0NTVi... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-15480?atlOrigin=eyJpIjoiMDQ0M2... ) HHH-15480 ( https://hibernate.atlassian.net/browse/HHH-15480?atlOrigin=eyJpIjoiMDQ0M2... ) Merging of ModWorkUnit with CollectionChangeWorkUnit followed by another ModWorkUnit leads to lost modified flags ( https://hibernate.atlassian.net/browse/HHH-15480?atlOrigin=eyJpIjoiMDQ0M2... )
Change By: Artёm Basov ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
This is, in a sense, a combination of [HHH-7918|https://hibernate.atlassian.net/browse/HHH-7918] and [HHH-7948|https://hibernate.atlassian.net/browse/HHH-7948].
Steps:
# Tx1: Create {{ListRefEdEntity}}
# Tx2:
## Fetch {{ListRefEdEntity}} created at (1)
## Create and persist {{ListRefIngEntity}} associated with {{ListRefEdEntity}} fetched at (a)
## Change its data , associate with {{ListRefIngEntity}}
## Flush
## Change its data again
This will lead to 2nd revision of {{ListRefEdEntity}} with {{reffering_mod=false}}
See a [PR|https://github.com/hibernate/hibernate-orm/pull/5253] for a test case.
We’ve caught this in {{5.4.32}}, but since test case fails on {{main}}, I’m assuming it affects every version since {{5.4.32}}
The way I see the problem is that by discarding both {{CollectionChangeWorkUnit}} and {{ModWorkUnit#data}} that contain calculated {{*_MOD}} flags, we are relying on the difference between {{oldState}} and {{newState}}, but debug shows that both states already contain added {{ListRefIngEntity}}, so comparing those gives us {{false}}.
From what I see, {{FlushEntityEvent}} is created with the entities state from {{PersistentContext}} and it differs from what it is in DB.
If we can’t rely on the difference between the states, I guess our only option is to store {{CollectionChangeWorkUnits}} inside {{ModWorkUnit}} and apply those right before execution. Am I missing something?
( https://hibernate.atlassian.net/browse/HHH-15480#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-15480#add-comment?atlOrigin=ey... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100206- sha1:3ac329d )
2 years, 6 months