如果不存在Hibernate4和spring4 for mysql,则不会自动创建架构 [英] Schema is not created automatically if not exist Hibernate4 and spring4 for mysql

查看:86
本文介绍了如果不存在Hibernate4和spring4 for mysql,则不会自动创建架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hibernate属性



hibernate.dialect = org.hibernate.dialect.MySQLDialect

hibernate.show_sql = true

hibernate.hbm2ddl.auto = create-update **我也单独使用这些关键字//创建或//更新**







** xml配置**



< bean id =sessionFactory>

class =org.springframework.orm.hibernate4.LocalSessionFactoryBean>

< property name =dataSourceref =dataSource>

< property name =packagesToScanvalue =com.testing.domain>

< property name =hibernateProperties>

< props>

< prop key =hibernate.dialect> $ {hibernate.dialect}

< prop key =hibernate.show_sql> $ {hibernate.show_sql}

< prop key =hibernate.hbm2ddl.auto> $ {hibernate.hbm2ddl.auto}






hibernate properties

hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=true
hibernate.hbm2ddl.auto=create-update ** i use these keyword seperately also //create or//update**



**xml configuration**

<bean id="sessionFactory">
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource">
<property name="packagesToScan" value="com.testing.domain">
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}
<prop key="hibernate.show_sql">${hibernate.show_sql}
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}



推荐答案

{hibernate.dialect}

< prop key =hibernate.show_sql>
{hibernate.dialect}
<prop key="hibernate.show_sql">


{hibernate.show_sql}

< prop key =hibernate.hbm2ddl.auto>
{hibernate.show_sql}
<prop key="hibernate.hbm2ddl.auto">


{hibernate.hbm2ddl.auto}






{hibernate.hbm2ddl.auto}




这篇关于如果不存在Hibernate4和spring4 for mysql,则不会自动创建架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆