title: Hibernate dialect issue with Spring configuration
body: <p>I use Hibernate (through JPA) configured by Spring and when I launch my application (war deployed on Tomcat 6), I get this error:</p>
  
  <pre><code>org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set 
  </code></pre>
  
  <p>It seems strange because I've set the hibernate dialect as follows:</p>
  
  <pre><code>p:databasePlatform="org.hibernate.dialect.MySQL5Dialect
  </code></pre>
  
  <p>For more information, here my full applicationContext.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:p="http://www.springframework.org/schema/p"
         xmlns:context="http://www.springframework.org/schema/context"
         xmlns:tx="http://www.springframework.org/schema/tx"
         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
             http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
             http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd"&gt;
  
  
      &lt;bean id="dataSource"
            class="org.springframework.jdbc.datasource.DriverManagerDataSource"
            p:driverClassName="com.mysql.jdbc.Driver"
            p:url="jdbc:mysql://localhost/room_management" p:username="root" p:password=""/&gt;
  
      &lt;bean id="entityManagerFactory"
            class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
            p:dataSource-ref="dataSource" p:persistenceUnitName="RoomManagement"&gt;
          &lt;property name="jpaVendorAdapter"&gt;
              &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
                    p:database="MYSQL"
                    p:databasePlatform="org.hibernate.dialect.MySQL5Dialect"
                    p:showSql="true"/&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="transactionManager"
            class="org.springframework.orm.jpa.JpaTransactionManager"
            p:entityManagerFactory-ref="entityManagerFactory"/&gt;
  
      &lt;context:annotation-config/&gt;
  
  
      &lt;context:component-scan base-package="com.parisdescartes.roommanagement.*"/&gt;
  
      &lt;tx:annotation-driven/&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>So, I decided to precise Hibernate Dialect within META-INF/persistence.xml file, and this time that works. Here how I precised it:</p>
  
  <pre><code>&lt;properties&gt;
              &lt;property name="hibernate.dialect"
                        value="org.hibernate.dialect.MySQL5Dialect"/&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p>Do you have an idea why Hibernate Dialect is not set using Spring configuration ?</p>