title: COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'latin1' - even if utf8 is setup
body: <p>In our database we store <em>everyting</em> with the character set utf8, and use <code>COLLATE utf8_general_ci</code>.</p>
  
  <p>However, when querying data from <strong>one</strong> table, we always receive the following exception: </p>
  
  <pre><code>Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'latin1'
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
      at com.mysql.jdbc.Util.getInstance(Util.java:360)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:978)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823)
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2530)
      at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1907)
      at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2030)
      at org.jboss.jca.adapters.jdbc.CachedPreparedStatement.executeQuery(CachedPreparedStatement.java:111)
      at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:462)
      at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:80)
      ... 120 more
  </code></pre>
  
  <p>We cross checked everything we could imagine: </p>
  
  <pre><code>SHOW VARIABLES LIKE '%char%';
  
  character_set_client    utf8
  character_set_connection    utf8
  character_set_database  utf8
  character_set_filesystem    binary
  character_set_results   utf8
  character_set_server    utf8
  character_set_system    utf8
  </code></pre>
  
  <p>as well as</p>
  
  <pre><code>SHOW VARIABLES LIKE '%collation%';
  
  collation_connection    utf8_general_ci
  collation_database  utf8_general_ci
  collation_server    utf8_general_ci
  </code></pre>
  
  <p>Also </p>
  
  <pre><code>SELECT * FROM information_schema.`COLUMNS` WHERE TABLE_SCHEMA = "ourscheme" and Character_set_name &lt;&gt; "utf8";
  
  (empty result)
  </code></pre>
  
  <p>We ensured, client connections are using utf-8.</p>
  
  <p>We are out of ideas. The table and column(s) are setup correctly it seems. </p>
  
  <p>We also tried to explicit use the COLLATE in the query: </p>
  
  <pre><code>...table.column COLLATE utf8_general_ci AS 'column'
  </code></pre>
  
  <p>If we modify the query to THIS: </p>
  
  <pre><code>...table.column COLLATE latin1_general_ci AS 'column'
  </code></pre>
  
  <p>It works. How can it be, that mysql is showing utf8 EVERYWHERE - but the query fails and only works for latin1 collations?</p>
  
  <p>The table in question is generated upon every application start, having as well explicit set the default charset and the default Collate.</p>
  
  <p>Using the very same "code", we generate 8 more tables - where the problem is NOT existing.</p>
  
  <p>Any Ideas? The envronment is : </p>
  
  <ul>
  <li>Wildfly 8.1</li>
  <li>MySQL 5.6.26 x64</li>
  <li>Hibernate 4.3.5.Final</li>
  </ul>