问题
I have the following hibernate entity:
@Table(name="tbl_template")
@Entity
@Audited
public class StatementTemplate {
private Long id;
@Column(name = "template_name")
private String templateName;
...
}
I changed the column name from template_name to stmt_name
@Column(name = "stmt_name")
private String templateName;
It turned out that the instead of changing the column name hibernate added another column named stmt_name, now I have template_name as well as stmt_name
I have following hibernate properties set up
<prop key="hibernate.hbm2ddl.auto">update</prop>
How can I get the column altered from template_name to stmt_name?
回答1:
Stopping your app, running ALTER TABLE, and starting the app again?
来源:https://stackoverflow.com/questions/8695019/how-to-alter-column-name-in-hibernate-entity