码迷,mamicode.com
首页 > 数据库 > 详细

【方言】Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

时间:2015-08-05 21:57:26      阅读:480      评论:0      收藏:0      [点我收藏+]

标签:

Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect‘ not set

两个实现 方言配置差异

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
    <persistence-unit name="userPU" transaction-type="RESOURCE_LOCAL">
        <!--jpa的提供者-->
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <properties>
            <!--声明数据库连接的驱动-->
            <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
            <!--jdbc数据库的连接地址-->
            <property name="hibernate.connection.url" value="jdbc:mysql://10.32.11.74:3306/jparest"/>
            <property name="hibernate.connection.username" value="root"/>
            <property name="hibernate.connection.password" value="123456"/>
            <!--配置方言-->
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
            <!--激活查询日志功能-->
            <property name="hibernate.show_sql" value="true"/>
            <!--优雅地输出Sql-->
            <property name="hibernate.format_sql" value="true"/>
            <!--添加一条解释型标注-->
            <property name="hibernate.use_sql_comments" value="false"/>
            <!--配置如何根据java模型生成数据库表结构,常用update,validate-->
            <property name="hibernate.hbm2ddl.auto" value="update"/>
        </properties>
    </persistence-unit>
</persistence>

 

 

 <property name="jpaVendorAdapter">
            <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                <property name="showSql" value="${hibernate.showSql}" />
                <property name="generateDdl" value="true" />

                <property name="databasePlatform"
                          value="org.hibernate.dialect.MySQL5Dialect">
                </property>
            </bean>
        </property>

 

【方言】Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

标签:

原文地址:http://www.cnblogs.com/viewcozy/p/4705867.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!