Last active
August 18, 2018 22:14
-
-
Save marcelo-michels/cc250feb57e5d850f4d06c6f1a373a59 to your computer and use it in GitHub Desktop.
Wildfly DataSource para PostgreSQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- {wildfly_dir}\modules\system\layers\base\org\postgresql\main\module.xml --> | |
<!-- Na mesma pasta do module.xml é preciso adicionar o driver jdbc do PostgreSQL condizente ao nome em resource-root path --> | |
<!-- JAR Download: http://central.maven.org/maven2/org/postgresql/postgresql/9.4.1211/postgresql-9.4.1211.jar --> | |
<?xml version="1.0" encoding="UTF-8"?> | |
<module xmlns="urn:jboss:module:1.0" name="org.postgresql"> | |
<resources> | |
<resource-root path="postgresql-9.4.1211.jar"/> | |
</resources> | |
<dependencies> | |
<module name="javax.api"/> | |
<module name="javax.transaction.api"/> | |
</dependencies> | |
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<persistence version="2.1" | |
xmlns="http://xmlns.jcp.org/xml/ns/persistence" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> | |
<persistence-unit name="bell-adm" > | |
<provider>org.hibernate.ejb.HibernatePersistence</provider> | |
<!-- jta-data-source deve conter o mesmo nome definido em datasource jndi-name no arquivos standalone.xml --> | |
<jta-data-source>java:/BellAdmDS</jta-data-source> | |
<!-- Entidades --> | |
<class>br.com.belladm.model.orm.Usuario</class> | |
<class>br.com.belladm.model.orm.Empresa</class> | |
<properties> | |
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/> | |
<property name="hibernate.hbm2ddl.auto" value="update"/> | |
<property name="hibernate.show_sql" value="true"/> | |
</properties> | |
</persistence-unit> | |
</persistence> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- {wildfly_dir}\standalone\configuration\standalone.xml --> | |
<subsystem xmlns="urn:jboss:domain:datasources:4.0"> | |
<datasources> | |
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true"> | |
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url> | |
<driver>h2</driver> | |
<security> | |
<user-name>sa</user-name> | |
<password>sa</password> | |
</security> | |
</datasource> | |
<datasource jndi-name="java:/BellAdmDS" pool-name="BellAdmDS" enabled="true" use-java-context="true"> | |
<connection-url>jdbc:postgresql://localhost:5432/belladm</connection-url> | |
<driver>org.postgresql</driver> | |
<pool> | |
<min-pool-size>10</min-pool-size> | |
<max-pool-size>100</max-pool-size> | |
<prefill>true</prefill> | |
</pool> | |
<security> | |
<user-name>postgres</user-name> | |
<password>postgres</password> | |
</security> | |
</datasource> | |
<drivers> | |
<driver name="h2" module="com.h2database.h2"> | |
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class> | |
</driver> | |
<driver name="org.postgresql" module="org.postgresql"> | |
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class> | |
</driver> | |
</drivers> | |
</datasources> | |
</subsystem> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment