title: Wildfly 10 with Postgres 9.6.6 and Hibernate 5.2.12.final
body: <p>I am trying to get a Java8EE application working on Wildfly10 and Postgres 9.6.6.</p>
  <p>Somehow I allways bump into the error that the relation cannot be found.</p>
  <p>My Postgres is running on localhost, default port. I am connecting with the user postgres and the correct password. The database (hbnac) has a schema with the same name.</p>
  <p>Wildfly is configured to use the database and the “Test connection” is confirming a successful connection.
  Using pgAdmin 4 I can also browse the database, see the schema, as well as the table group_member.</p>
  <p>The config in Jboss looks as follow:</p>
  <pre><code>&lt;datasource jta=&quot;false&quot; jndi-name=&quot;java:jboss/datasources/hbnac&quot; pool-name=&quot;hbnac&quot; enabled=&quot;true&quot; use-ccm=&quot;false&quot;&gt;
                  &lt;connection-url&gt;jdbc:postgresql://localhost:5432/hbnac&lt;/connection-url&gt;
                  &lt;driver-class&gt;org.postgresql.Driver&lt;/driver-class&gt;
                  &lt;driver&gt;postgres&lt;/driver&gt;
                  &lt;pool&gt;
                      &lt;min-pool-size&gt;1&lt;/min-pool-size&gt;
                      &lt;initial-pool-size&gt;1&lt;/initial-pool-size&gt;
                      &lt;max-pool-size&gt;10&lt;/max-pool-size&gt;
                      &lt;flush-strategy&gt;Gracefully&lt;/flush-strategy&gt;
                  &lt;/pool&gt;
                  &lt;security&gt;
                      &lt;user-name&gt;postgres&lt;/user-name&gt;
                      &lt;password&gt;password&lt;/password&gt;
                  &lt;/security&gt;
                  &lt;validation&gt;
                      &lt;valid-connection-checker class-name=&quot;org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker&quot;/&gt;
                      &lt;background-validation&gt;true&lt;/background-validation&gt;
                      &lt;exception-sorter class-name=&quot;org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter&quot;/&gt;
                  &lt;/validation&gt;
              &lt;/datasource&gt;
  </code></pre>
  <p>However, my application fails to select a record from the very same table, resulting in the following error:</p>
  <pre><code>Caused by: org.postgresql.util.PSQLException: ERROR: relation &quot;group_member&quot; does not exist
  </code></pre>
  <p>The configuration of my persistence.xml is doing a jndi lookup of the connection defined in Wildfly:</p>
  <pre><code>&lt;persistence-unit name=&quot;hbnac&quot;&gt;
      &lt;jta-data-source&gt;java:jboss/datasources/hbnac&lt;/jta-data-source&gt;
  
      &lt;class&gt;hbnac.birthday.domain.groupmember.GroupMember&lt;/class&gt;
  
      &lt;properties&gt;
          &lt;property name=&quot;hibernate.dialect&quot; value=&quot;org.hibernate.dialect.PostgreSQL94Dialect&quot; /&gt;
          &lt;!--property name=&quot;hibernate.hbm2ddl.auto&quot; value=&quot;validate&quot;/--&gt;
          &lt;!--property name=&quot;hibernate.default_schema&quot; value=&quot;hbnac&quot;/--&gt;
  
          &lt;property name=&quot;hibernate.show_sql&quot; value=&quot;true&quot;/&gt;
          &lt;property name=&quot;hibernate.format_sql&quot; value=&quot;true&quot; /&gt;
      &lt;/properties&gt;
  
  &lt;/persistence-unit&gt;
  </code></pre>
  
  <p>And obviously, the jta-data-source is matching the working datasource in Wildfly. As you can see, I have experimented a bit with the validate (which fails for the same reason at startup) and with the schema name, which also does not make a difference.</p>
  <p>The entity itsel is annoted:</p>
  <pre><code>@Entity
  @Table(name = &quot;group_member&quot;)
  public class GroupMember extends AbstractEntity {
  
  public final static String FACEBOOK_NAME_FIELD = &quot;facebookName&quot;;
  public final static String BIRTHDAY_FIELD = &quot;birthday&quot;;
  
  @Id
  @GeneratedValue(strategy= GenerationType.IDENTITY)
  private long id;
  </code></pre>
  <p>It has getters, setters, hashcode and equals methode for all fields available.</p>
  <p>If I copy the query generated by hibernate into pgadmin it also works perfectly...</p>
  <p>Any ideas left?</p>
  <p><a href="https://i.stack.imgur.com/FnbrX.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FnbrX.jpg" alt="A screenshot from the actual db in pgadmin" /></a></p>