如何在hibernate实体中更改列名? [英] How to alter Column name in hibernate entity?
本文介绍了如何在hibernate实体中更改列名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下hibernate实体:
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;
...
}
我将列名从template_name更改为stmt_name
I changed the column name from template_name to stmt_name
@Column(name = "stmt_name")
private String templateName;
事实证明,而不是更改列名hibernate添加了另一个名为stmt_name的列,现在我有了template_name以及stmt_name
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
我有以下hibernate属性设置
I have following hibernate properties set up
<prop key="hibernate.hbm2ddl.auto">update</prop>
如何将列从template_name更改为stmt_name?
How can I get the column altered from template_name to stmt_name?
推荐答案
停止你的应用程序,运行ALTER TABLE,然后再次启动应用程序?
Stopping your app, running ALTER TABLE, and starting the app again?
这篇关于如何在hibernate实体中更改列名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文