Configure Hibernate.cfg.xml with Datasource configured in Wildfly 10

Asked

Viewed 370 times

0

I’m trying to configure my Iberian to recognize the connection configured in Wildfly, already tested the connection in the wildfly panel, ta 100% functional. The problem now is to make the application that uses Hibernate view the DS.

1 answer

0

Just add the following setting to your file persistence.xmm

<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>

Follows Example: https://gist.github.com/marcelo-michels/cc250feb57e5d850f4d06c6f1a373a59#file-persistence-xml

Browser other questions tagged

You are not signed in. Login or sign up in order to post.