使用 hibernate hbm2ddl.auto=update :如何更改列不再需要值?

发布于 2024-07-17 12:31:50 字数 197 浏览 2 评论 0原文

我有一个曾经是 not-null="true" 的属性。 该字段不再需要值,因此我将其更改为 not-null="false" 但该表不会在数据库中更新。 添加新属性不会产生任何问题。

hbm2ddl.auto=update 是否可以自动更改表以删除 not-null="true" ? (我知道我可以编写一个sql脚本来更改它,但想让它自动更新)

I had a property that used to be not-null="true". Values aren't necessary for that field anymore so I changed it to not-null="false" but the table does not get updated in the database. Adding new properties doesn't give any problems.

Is it possible for hbm2ddl.auto=update to change the the table automatically to remove the not-null="true"? (I know I can just write a sql script to change it but would like to let it get updated automagically)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最终幸福 2024-07-24 12:31:50

据我所知: hbm2ddl.auto=update 不会更改已经有数据的表的非空值。

最后我只是编写了一个 sql 脚本来更改表。

From what I could gather: hbm2ddl.auto=update won't change not-null value for tables that already have data in.

In the end I just wrote a sql script to change the table.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文