I have and audited entity with a foreign key to a class (which I don't want to audit):
@Entity
@Audited
public class CitaAgenda {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "reconocimiento_id")
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
private Reconocimiento reconocimiento;
...
}
Also, Reconocimiento
is an entity with an embedded property:
@Entity
public class Reconocimiento {
@Embedded
private Enfermeria enfermeria;
...
}
And the embeddable class is as follows:
@Embeddable
public class Enfermeria {
private boolean diabetes;
...
}
Now, when I bring the data from the revisions and fetch CitaAgenda, I get a
"Can not set boolean field ...Enfermeria.diabetes to null value".
What I think it is happening is that Hibernate tries to init the enfermeria property of Reconocimiento with NULL because it believes all fields are NULL as the only field of Reconocimiento stored in the _AUD
table is the ID (as the others are not audited). But this is not true as if I audit the other fields, diabetes would be false and not NULL.
I cannot set diabetes to Boolean. Are there any other solutions? Thanks in advance.
@NotAudited
on Reconocimiento is what you want i believe - EugeneConverter
? - Naros