I am setting up our environment to use Hibernate-Envers 5.3.3 and we are using Java 1.8.0_181. We have existing tables that already have data. I have most of the table auditing working just fine, however I have run into a problem with combined columns. Does Envers support the use of the @Columns annotation?
For example, we have 5 columns in a database that represent a customers billing address : street address, city, state, postal code, and country. In our mapping, we combine those columns in order to create one Address Interface reference.
@Columns(columns = {
@Column(name="street_address"),
@Column(name="city"),
@Column(name="state"),
@Column(name="postalcode"),
@Column(name="country"),
})
protected Address customerAddress;
I've thought about including the columns separately, and having Envers audit them separately, but would like to forgo this option if a better solution exists. We use this notation for multiple tables, so I would like it to be a universal solution rather than table specific.
Yes the @Columns
annotation is supported.
The test suite for hibernate-envers
has numerous entity mappings that use it. If you are running into a situation where the mapping is giving you an error or the rows are not being audited as you expect, open a jira issue and report it here.