I have a Java class with these fields:
@Entity
public class Car {
@Column(name = "NAME", columnDefinition = "bytea")
@ColumnTransformer(read = “pgp_sym_decrypt(name, ‘mySecretKey’)”, write = “pgp_sym_encrypt(?, ‘mySecretKey’)”)
private String name;
@ManyToMany
@JoinTable(name = "STUDENT_CAR",
joinColumns = @JoinColumn(name = "CAR", referencedColumnName = "NAME", columnDefinition = "bytea"),
inverseJoinColumns = @JoinColumn(name = "STUDENT",referencedColumnName="NAME", columnDefinition="bytea"))
private List<Student> students;
}
I’d like to use the columnTransformer annotation even on the field students with the ManyToMany annotation.
I tried to apply the columnTransformer on that but It doesn’t encrypt/decrypt the columns of the “STUDENT_CAR” table.
Does anyone know another way to make it work?
Thank you all.
New contributor
Antonio Cristallo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1