问题
From my entity I'm trying to rename the id column field defined in AbstractPersistable by Spring Data Jpa using AttributeOverride annotation.
@Entity
@AttributeOverride(name="id", column=@Column(name="user_id"))
public class User extends AbstractPersistable<Long> {
...
this is failing with the exception
Caused by: org.hibernate.MappingException: Unable to find column with logical name: id in org.hibernate.mapping.Table(user) and its related supertables and secondary tables
the only time the above definition is passing and the DDL is generated is when I define the column name as ID like
@AttributeOverride(name="id", column=@Column(name="ID"))
Seems like a bug to me. I really don't get what the problem is.
来源:https://stackoverflow.com/questions/27316502/renaming-spring-data-jpa-id-column