HIBERNATE JPA POSTGRESQL, error in Persistence.xml

0

My persistence.xml file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

        <persistence-unit name="efactory">      
            <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
            <description>Configuración de JPA para el acceso a la base de datos</description>
            <class>com.apiux.entities.PersonaTest</class>
            <properties>
            <property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/apiux" />
                <property name="hibernate.connection.driver_class" value="org.postgresql.Driver" />
                <property name="hibernate.connection.username" value="postgres" />
                <property name="hibernate.connection.password" value="apiux" />
                <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
            </properties>
        </persistence-unit>

</persistence>

But when I start the process and enter the endpoint to recover the data, I get the following error message:

  

"JBWEB000065: HTTP Status 500 - javax.persistence.PersistenceException: No Persistence provider for EntityManager named efactory"

I have reviewed previous topics and they all advise changing the <provider> tag, I did it but it does not work.

Any ideas or advice?

    
asked by Miguel Angel 09.01.2018 в 14:31
source

1 answer

1

link

<persistence-unit name="Persistencia" transaction-type="RESOURCE_LOCAL">

    <properties>
        <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" /> <!-- DB Driver -->
        <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/hibernate" /> <!-- BD Mane -->
        <property name="javax.persistence.jdbc.user" value="postgres" /> <!-- DB User -->
        <property name="javax.persistence.jdbc.password" value="wester" /> <!-- DB Password -->

    <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/> <!-- DB Dialect -->
        <property name="hibernate.hbm2ddl.auto" value="update" /> <!-- create / create-drop / update -->

        <property name="hibernate.show_sql" value="true" /> <!-- Show SQL in console -->
        <property name="hibernate.format_sql" value="true" /> <!-- Show SQL formatted -->
    </properties>

</persistence-unit>

    
answered by 12.11.2018 в 22:08