title: MySQL UTF8 with Hibernate 3 and Spring
body: <p>All my tables in the schema are set to UTF-8 as the default charset, but I can't manage to get Hibernate insert correctly symbols like "é" or "ñ" (they are inserted as "Ã©" or "Ã±").</p>
  
  <p>My configuration is the following:</p>
  
  <pre><code>&lt;bean id="dataSource"
      class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
      &lt;property name="url" value="${db.url}"&gt;&lt;/property&gt;
      &lt;property name="username" value="${db.user}"&gt;&lt;/property&gt;
      &lt;property name="password" value="${db.password}"&gt;&lt;/property&gt;
      &lt;property name="driverClassName" value="${db.driver}"&gt;&lt;/property&gt;
  &lt;/bean&gt;
  &lt;bean id="sessionFactory"
      class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt;
      &lt;property name="dataSource" ref="dataSource"&gt;&lt;/property&gt;
      &lt;property name="hibernateProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.connection.useUnicode"&gt;true&lt;/prop&gt;
              &lt;prop key="hibernate.connection.characterEncoding"&gt;UTF-8&lt;/prop&gt;
              &lt;prop key="hibernate.connection.charSet"&gt;UTF-8&lt;/prop&gt;
              &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQL5InnoDBDialect&lt;/prop&gt;
              &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
  </code></pre>
  
  <p>I've tried adding <em>?useUnicode=true&amp;characterEncoding=UTF-8</em> to the connection URL, but with no results... Any idea?</p>