怎样把hibernate文件转成数据库表?(50分)

L

lyzpyp

Unregistered / Unconfirmed
GUEST, unregistred user!
怎样把hibernate文件转成数据库表
 
Hibernate support db table automatic creation. You can set up your server file hibernate.cfg.xml to make it happen, but you should remember to change the setting to disable the auto-creation otherwise, the second time you restart your service, it willdo
the samething and erase all your test data.
 
在hibernate.cfg.xml文件的<session-factory>中加入“<property name=&quot;hibernate.hbm2ddl.auto&quot;>update</property>”这句话,那么加载hibernate后,在程序访问到所需表时,会自动根据你的*.hbm.xml生成该数据表。前提是你必须先把jdbc配好。
 
顶部