SSH中已经配置好sessionFactory,服务器启动的时候没有报错。为什么无法创建数据库表?
applicationContext.xml:<context:property-placeholderlocation="classpath:db.properties...
applicationContext.xml:
<context:property-placeholder location="classpath:db.properties"/>
<!-- 数据源 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="user" value="${jdbc.user}"></property>
<property name="password" value="${jdbc.password}"></property>
<property name="driverClass" value="${jdbc.driverClass}"></property>
<property name="jdbcUrl" value="${jdbc.jdbcUrl}"></property>
<property name="initialPoolSize" value="${jdbc.initPoolSize}"></property>
<property name="maxPoolSize" value="${jdbc.maxPoolSzie}"></property>
</bean>
<!-- 配置 sessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
<property name="mappingLocations" value="classpath:com/beans/*.hbm.xml"></property>
</bean>
hibernate.cfg.xml:
<hibernate-configuration>
<session-factory>
<!-- 方言 -->
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<!-- 显示以及格式化SQL -->
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>
<!-- 生成数据表的策略 -->
<property name="hibernate。hbm2ddl。auto">update</property>
</session-factory>
</hibernate-configuration> 展开
<context:property-placeholder location="classpath:db.properties"/>
<!-- 数据源 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="user" value="${jdbc.user}"></property>
<property name="password" value="${jdbc.password}"></property>
<property name="driverClass" value="${jdbc.driverClass}"></property>
<property name="jdbcUrl" value="${jdbc.jdbcUrl}"></property>
<property name="initialPoolSize" value="${jdbc.initPoolSize}"></property>
<property name="maxPoolSize" value="${jdbc.maxPoolSzie}"></property>
</bean>
<!-- 配置 sessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
<property name="mappingLocations" value="classpath:com/beans/*.hbm.xml"></property>
</bean>
hibernate.cfg.xml:
<hibernate-configuration>
<session-factory>
<!-- 方言 -->
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<!-- 显示以及格式化SQL -->
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>
<!-- 生成数据表的策略 -->
<property name="hibernate。hbm2ddl。auto">update</property>
</session-factory>
</hibernate-configuration> 展开
2个回答
仁科信息
2024-07-24 广告
2024-07-24 广告
K8s运维服务,是仁科信息针对企业容器化部署需求提供的全面解决方案。我们基于Kubernetes原生架构,提供专业咨询、部署、更新、扩缩容、巡检、故障排除等服务,确保客户能够高效、安全地管理容器集群。我们团队具备丰富的实践经验和专业认证,致...
点击进入详情页
本回答由仁科信息提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询