title: Hibernate, MySQL Encoding does not work on debian
body: <p>I've made an application in Java EE that uses Hibernate to communicate with MySQL. It works perfectly on my Windows development machine, but I have problem on debian, where the application is deployed.</p>
  
  <p>When I search for keyword with Polish letters(like ł, ą, ć, ó etc,) the result is ok on Windows, but on server, where I have imported the database it does not work.</p>
  
  <p>Hibernate query looks like this:</p>
  
  <pre><code>@NamedQuery(name = "Keyword.findByKeyword", query = "SELECT k FROM Keyword k WHERE k.keyword = :keyword")
  </code></pre>
  
  <p>and is called like this:</p>
  
  <pre><code>myEntityManager.createNamedQuery("Keyword.findByKeyword").setParameter("keyword", keyword).getSingleResult();
  </code></pre>
  
  <p>When I use mysql on debian via SSH and type in SELECT query manually:</p>
  
  <pre><code>SELECT * FROM keywords WHERE keyword = 'ser żółty';
  </code></pre>
  
  <p>it also works and return single result. Encoding and collations of tables and columns are also ok. In datasource configuration I've added </p>
  
  <pre><code>?UseUnicode=true&amp;amp;characterEncoding=utf8
  </code></pre>
  
  <p>parameters, but it also did not help. I thought that maybe there is a problem with encoding in data from request send by form, but the problem appears even if the parameter i.e. "ser żółty" is hardcoded in my repository class.</p>
  
  <p>I also use Hibernate Search for indexing and the FullTextEntityManager return correct results with Polish letters.</p>
  
  <p>I assume that there is some problem between Hibernate and MySQL, but I have no more ideas what could I change. Any suggestions?</p>
  
  <p>Server Wildfly9.0.1, MySQL 5.6</p>