In my auditable entities I have field creationUser
which I would like to not update in db on merge
operation.
Here is my entity code:
@Column(updatable=false)
@ManyToOne(cascade = CascadeType.MERGE)
public User creationUser;
But it gives me an error:
Unexpected exception
PersistenceException: [PersistenceUnit: defaultPersistenceUnit] Unable to build EntityManagerFactory
Caused by: org.hibernate.AnnotationException: @Column(s) not allowed on a @ManyToOne property: models.AreaOfMedicine.creationUser
So how can I prevent from updating that field? Please help
@Column
and@ManyToOne
can't be specified together in this case. Remove@Column
! – Gustafson