0

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?

New contributor
loupeznik is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
1
  • It is unusual to set a list of decimal in a database column. Commented 6 hours ago

1 Answer 1

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.