Hibernate:只有在不存在的情况下才使数据库 [英] Hibernate: make database only if not exists
本文介绍了Hibernate:只有在不存在的情况下才使数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
现在在hibernate.cfg.xml中我有这样的一行:
< property name =hibernate.hbm2ddl.auto> create< / property>
问题是数据库文件一直在创建,即使文件存在。尝试将值切换到 update
解决方案
< property name =hibernate.hbm2ddl.auto>更新< / property>
I want Hibernate make database file (SQLite), but only if not exists.
Now in hibernate.cfg.xml I have this line:
<property name="hibernate.hbm2ddl.auto">create</property>
The problem is that database file is been creating in all the time, even the file exists.
解决方案
Try switching the value to update
<property name="hibernate.hbm2ddl.auto">update</property>
这篇关于Hibernate:只有在不存在的情况下才使数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文