jdbc配置:
driverClass=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/mydata
user=root
password=root
当数据库中没有mydata表时,无法自动创建,且tomcat启动不了,停留在Initializing Spring root WebApplicationContext。如果手动创建mydata表,tomcat可以启动,项目也能运行。
hibernate配置:
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<!-- 数据库言 -->
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<!-- 加载二级缓存插件(可选) -->
<property name="hibernate.cache.region.factory_class">org.hibernate.cache.EhCacheRegionFactory</property>
<property name="hibernate.cache.use_query_cache">true</property>
<!-- 配置自动生成DDL语句 -->
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- 在控制台打印出当前的sql语句 -->
<property name="hibernate.show_sql">true</property>
<!-- 注册对象关系映射 -->
</session-factory>