I am setting up a datasource in Wildfly and when hibernate will create the tables, it is creating in the postgres database instead of the last database. Below is part of XML:
<datasource jndi-name="java:/Teste" pool-name="Teste" enabled="true">
<connection-url>jdbc:postgresql://localhost:5432/teste</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<datasource-class>org.postgresql.ds.PGSimpleDataSource</datasource-class>
<driver>postgres</driver>
<security>
<user-name>postgres</user-name>
<password>senha</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
<background-validation>true</background-validation>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
</validation>
</datasource>
I used the Wildfly console itself to create this DataSource connection. The driver version is postgresql-42.2.5 The funniest thing is that it just happens in wildfly, as I did a test build application console and create a table with jdbc in hand and it worked.