Wildfly and auto reconnect to the database
I solved this problem by changing the validate-on-match value to true in my standalone-full.xml file:
<validate-on-match>true</validate-on-match>
This working on Wildfly 8.1:
<datasource jta="true" jndi-name="java:jboss/datasources/xxxdb" pool-name="xxxxDB" enabled="true" use-ccm="false">
<connection-url>jdbc:mysql://localhost:3306/xxxdb?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver>mysql-connector-java-5.1.26-bin.jar</driver>
<security>
<user-name>xxxuser</user-name>
<password>xxxpassword</password>
</security>
<validation>
<check-valid-connection-sql>select 1</check-valid-connection-sql>
<validate-on-match>false</validate-on-match>
<background-validation>true</background-validation>
<background-validation-millis>10000</background-validation-millis>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>