title: Integrating Spring + Hibernate + Sql server with unicode support
body: <p>How could I integrate Spring with Hibernate using sql server 2005 and have Unicode support.
  I tried many different ways but I just couldn't get it to work.</p>
  
  <p>Column in the table is nvarchar, character set in Spring is UTF-8.
  I can read Unicode text (which I added myself using the sql server management tool) just fine but writing doesn't work, it get's gibberished in the DB.</p>
  
  <p>jdbc url is</p>
  
  <pre><code>jdbc:sqlserver://localhost:1433;useUnicode=true;characterEncoding=UTF-8;databaseName=test;
  </code></pre>
  
  <p>with these properties in the hibernate configuration file</p>
  
  <pre><code>&lt;property name="hibernate.connection.useUnicode"&gt;true&lt;/property&gt;
  &lt;property name="hibernate.connection.charSet"&gt;UTF8&lt;/property&gt;
  </code></pre>
  
  <p>I also have a filter which changes the encoding for all pages</p>
  
  <pre><code>response.setContentType("text/html; charset=UTF-8");
  request.setCharacterEncoding("UTF8");
  
  chain.doFilter(request, response);
  
  //do it again, since JSPs will set it to the default
  response.setContentType("text/html; charset=UTF-8");
  request.setCharacterEncoding("UTF8");
  </code></pre>
  
  <p>is there some good soul who succeeded in doing so, and can help?</p>
  
  <p>Many thanks!</p>