Reputation: 1
I have an entity
@Entity
@Audited
class ValuesHolder(
// other fields
@Column(columnDefinition = "NUMERIC(18,6)[]", nullable = false)
var values: List<BigDecimal?>,
)
When I make any changes to the values hibernate envers doesn't recognize it as a change and doesn't audit the changes. Why is that? And how do I make it so? Do i need to do that manually?
Upvotes: 0
Views: 30
Reputation: 41
Try using @ElementCollection annotation, generally, Hibernate Envers might not recognize changes to a collection of mutable objects like List<BigDecimal?>.
@Entity
@Audited
class ValuesHolder(
// other fields
@ElementCollection
@Column(columnDefinition = "NUMERIC(18,6)", nullable = false)
var values: List<BigDecimal?>,
)
@ElementCollection ensures that Hibernate treats the collection elements as part of the entity and performs dirty checking on the collection. Changes to the collection or its elements will be detected and audited by Envers.
Upvotes: 0