I’d like to modify a database field (Char[50]) , as a java String field, via @Column, and a setter method.
But the Column is already used , to create an object field, via @ManyToOne and @JoinColumn. So, when I try to create the String field with @Column I get a org.hibernate.MappingException: Repeated column in mapping for entity: ... (should be mapped with insert="false" update="false") error.
Is there a solution? I’d expect it’d be possible to use the same column for different things?
What kind of reference do you want? It’s essentially just saying that values from the attribute should not be used to either insert or update into the columns that are mentioned. Usually, this is used if you want to map a column multiple times, but Hibernate only allows writing to the column through a single attribute. If there were multiple paths with multiple values, it wouldn’t be clear which value to use. See the Javadoc for more information: Column (Java(TM) EE 7 Specification APIs)