We have the following data structure:
@Audited(WithModifiedFlag = true)
@Entity
public class A {
private int id;
@Id
@DocumentId
@GeneratedValue( strategy = GenerationType.IDENTITY )
public int getId() {
return id;
}
private UUID uuid;
@Column( name = "uuid", columnDefinition = "BINARY(16)" )
public UUID getUuid() {
return uuid;
}
private String name;
@Column( name = "name" )
public String getName() {
return name;
}
private Set<String> relatedA = new HashSet<>();
@ElementCollection
@CollectionTable( name = "a_to_a",
joinColumns = @JoinColumn( name = "a_right", referencedColumnName = "uuid" ) )
@Column( name = "a_left" )
@NotAudited
public Set<String> getRelatedA() {
return relatedA;
}
}
The problem is, that this gives us a MappingException claiming Duplicate property mapping for the modified_flag column of uuid.
I am assuming that JoinColumn in this context expects a non-existent field in referencedColumnName and automatically attempts creating the audit fields required?
The whole thing works if we add @NotAudited to getUuid() and I don't quite understand why.