我有以下 hibernate 实体:
@Table(name="tbl_template")
@Entity
@Audited
public class StatementTemplate {
private Long id;
@Column(name = "template_name")
private String templateName;
...
}
我将列名称从 template_name 更改为 stmt_name
@Column(name = "stmt_name")
private String templateName;
事实证明,hibernate 添加了另一个名为 stmt_name 的列,而不是更改列名,现在我有了 template_name 和 stmt_name
我设置了以下 hibernate 属性
<prop key="hibernate.hbm2ddl.auto">update</prop>
如何将列从 template_name 更改为 stmt_name?
最佳答案
停止您的应用程序,运行 ALTER TABLE,然后再次启动应用程序?
关于java - 如何更改 hibernate 实体中的列名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8695019/