JPA: could not find TransactionManager

I am using JPA 2 in a JSF 2 project, so I am setting up my data source in GlassFish v3, everything is fine, but if I try to check JPA requests in Hibernate Tools, it will give me the following error:

Sessionfactory error:Could not locate TransactionManager

Here is my persistence.xml:

<?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="SuaParte" transaction-type="JTA">
        <jta-data-source>jdbc/suaparte_ds</jta-data-source>
        <class>entity.Area</class>
        <properties>
            <property name="eclipselink.logging.level" value="FINE"/>
            <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
        </properties>


    </persistence-unit>
</persistence>

I am using EclipseLink 2.3 (Indigo) and JPA 2 in my Eclipse JSF 2 project.

EDIT Follow @fonini's approach, my hibernate.properties:

hibernate.connection.username=<filled>
hibernate.connection.password=<filled>
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.connection.url=<filled>
hibernate.connection.provider_class=org.hibernate.connection.DriverManagerConnectionProvider
hibernate.datasource=jdbc/suaparte_ds
hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup

But now it gives me another error: error

id generatorDid I have to change in my entities?

    @Entity
    @Table(name="product")
    public class Product implements Serializable {
        private static final long serialVersionUID = 1L;

        @Id
        @GeneratedValue(strategy=GenerationType.SEQUENCE)
        private Integer id;

        @Size(max=150, message="150 caracteres no máximo")
        private String description;

        // getters and setter
}
+5
source share
1 answer

Since Hibernate Tools runs inside Eclipse, it does not have access to application server data resources.

, .

:

hibernate.connection.username=user
hibernate.connection.password=pass
hibernate.connection.driver_class=org.PostgreSQL.Driver
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.connection.url=jdbc:postgresql...

hibernate.connection.provider_class=org.hibernate.connection.DriverManagerConnectionProvider
hibernate.datasource=
hibernate.transaction.manager_lookup_class=
0

All Articles