Abdullah B. Shahen (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=60f4883...
) *created* an issue
Hibernate OGM (
https://hibernate.atlassian.net/browse/OGM?atlOrigin=eyJpIjoiYjAzY2NmNTUw...
) / Bug (
https://hibernate.atlassian.net/browse/OGM-1586?atlOrigin=eyJpIjoiYjAzY2N...
) OGM-1586 (
https://hibernate.atlassian.net/browse/OGM-1586?atlOrigin=eyJpIjoiYjAzY2N...
) Enverse: Wrong Auditing of @ManyToMany or ElementCollection Fileds (
https://hibernate.atlassian.net/browse/OGM-1586?atlOrigin=eyJpIjoiYjAzY2N...
)
Issue Type: Bug Affects Versions: 6 Assignee: Unassigned Created: 17/Mar/2023 07:02 AM
Priority: Major Reporter: Abdullah B. Shahen (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=60f4883...
)
Hi everyone,
We are using Hibernate Envers 6.1.7.Final for our Auditing functionality. The Problem
we’re facing right now is the following:
We have an Audited Entity (provided below) that contains some ManyToMany /
ElementCollection Fields that also need to be audited. However, when I change the value of
any filed (e.g. changing the name from “x” to “y”), Envers detects that change, and it
marks also all ManyToMany / ElementCollection Fields as changed. This is not true. They
should not be marked as changed.
*The Entity:*
@Entity
@Audited(withModifiedFlag = true)
public abstract class Element {
@Id
private Long id;
private String name;
@ElementCollection
@CollectionTable(
name = "element_tags",
joinColumns = @JoinColumn(name = "element_id", referencedColumnName =
"id"),
foreignKey = @ForeignKey(name = "fk_element_tags_on_element_id"))
private List<String> tags = new ArrayList<>();
@ManyToMany
@OrderBy("plannedEnd asc")
@JoinTable(
name = "element_milestones",
joinColumns = @JoinColumn(name = "element_id", referencedColumnName =
"id"),
inverseJoinColumns =
@JoinColumn(name = "milestone_id", referencedColumnName =
"milestone_id"),
foreignKey = @ForeignKey(name = "fk_element_milestones_on_element_id"),
inverseForeignKey = @ForeignKey(name =
"fk_element_milestones_on_milestone_id"))
private Set<Milestone> milestones = new HashSet<>();
...
}
Am I doing something wrong that’s causing this issue? Or is it a limitation in HN Envers?
P.S. A Test case that reproduces this issue is being created and will be provided soon.
Many thanks for considering my request.
(
https://hibernate.atlassian.net/browse/OGM-1586#add-comment?atlOrigin=eyJ...
) Add Comment (
https://hibernate.atlassian.net/browse/OGM-1586#add-comment?atlOrigin=eyJ...
)
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=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100218- sha1:9826a04 )