在spring中配置hibernate.hbm2ddl.auto=true自动建表 .

来源:互联网 发布:麻将辅助软件 编辑:程序博客网 时间:2024/05/29 09:29
今天 在spring中配置了 hibernate 的hibernate.hbm2ddl.auto 属性为update ,配置信息如下: 
   <property name="hibernateProperties">
<value>
<!-- hibernate.dialect=org.hibernate.dialect.MySQLDialect -->
hibernate.dialect=org.hibernate.dialect.DB2Dialect
hibernate.hbm2ddl.auto=update
hibernate.format_sql=true
hibernate.jdbc.batch_size=50
hibernate.connection.autocommit=true
hibernate.connection.charset=GBK
hibernate.show_sql=true
</value>
   </property>

启动tomcat 正常。  然后去 数据库看表还是没有被创建。。

  需要将 tomcat 的 bin路径 配置到path环境变量中, 配置如下:
  CATALINA_HOME  :  D:\apache-tomcat-6.0.20
  path : %CATALINA_HOME%\bin
0 0
原创粉丝点击