Hibernate Spring encode charater set wrong [UTF-8]
<p>Development environment:</p>

<ul>
<li>Spring 4.2x </li>
<li>Hibernate 4.3.11 </li>
<li>Tomcat 8 server </li>
<li>MySQL 5.4</li>
</ul>

<p>Before make the change to Hibernate there was no problem inserting, retrieving and displaying the characters.  However after making the change in my DAO to use Hibernate oddly i can't seem to insert the correct character in to the MySQL DB.</p>

<p>I have made sure that MySQL Schema can indeed save UTF-8 Character set by using query "INSERT INTO <code>spring_normalize</code>.<code>offers</code> (<code>text</code>, <code>users_username</code>) VALUES ('ölm', 'lalalal');"  the output on the index.jsp is correct.</p>

<p>I modified my hibernate config </p>

<pre><code>&lt;bean id="sessionFactory"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
        &lt;property name="dataSource" ref="dataSource"&gt;&lt;/property&gt;
        &lt;property name="hibernateProperties"&gt;
            &lt;props&gt;
                &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQL5Dialect&lt;/prop&gt;
                &lt;prop key="hibernate.connection.useUnicode"&gt;true&lt;/prop&gt;&lt;!-- added --&gt;
                &lt;prop key="hibernate.connection.characterEncoding"&gt;UTF-8&lt;/prop&gt;&lt;!-- added --&gt;
                &lt;prop key="hibernate.connection.charSet"&gt;UTF-8&lt;/prop&gt;&lt;!-- added --&gt;

            &lt;/props&gt;
        &lt;/property&gt;

        &lt;property name="packagesToScan"&gt;
            &lt;list&gt;
                &lt;value&gt;com.caveofprogramming.pring.web.dao&lt;/value&gt;
            &lt;/list&gt;
        &lt;/property&gt;
    &lt;/bean&gt;
</code></pre>

<p>This doesn't seem to work</p>

<p>Check list:</p>

<ol>
<li>DB schema is set to utf8 - utf8_unicode_ci.</li>
<li>Hibernat config add charSet to UTF-8.</li>
<li>jsp page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8</li>
<li>I have also added filter as this post suggested... <a href="https://stackoverflow.com/questions/5928046/spring-mvc-utf-8-encoding">Spring MVC UTF-8 Encoding</a></li>
</ol>

<p><strong>* Update *</strong>
this is my bean and DAO</p>

<p>Form</p>

<pre><code>&lt;sf:form method="POST" action="${pageContext.request.contextPath}/docreate" commandName="offer"&gt;
    &lt;sf:input type="text" path="id" name="id" readonly="true" /&gt;
    &lt;label for="text"&gt;Text&lt;/label&gt;
    &lt;sf:textarea id="text" name="text" row="3" path="text"&gt;&lt;/sf:textarea&gt;
    &lt;sf:errors path="text" cssClass="error"&gt;&lt;/sf:errors&gt;
    &lt;input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/&gt;
    &lt;input type="submit" value="Submit"&gt;

&lt;/sf:form&gt;
</code></pre>

<p>Offer</p>

<pre><code>@Entity
@Table(name="offers")
 public class Offer{
  @Id
  private int id;
  private String text;

  getIn(){}
  .....
}
</code></pre>

<p>OfferDao</p>

<pre><code>public class OfferDao{
   @Autowired
   private SessionFactory sessionFactory;

   public Session currentSession(){
    return sessionFactory.getCurrentSession();
   }

   public boolean create(Offer offer){
     int hiberReturn =(int) currentSession().save(offer);

     return hiberReturn &gt;= 0;
   }
}  
</code></pre>

<p>Anyone who can help is much much appreciated... really.. many many thanks</p>