Class is Managed, but is not Listed in the persistence.xml file

Asked

Viewed 1,587 times

0

I’m having a problem that I wasn’t before I migrated to JPA 2.0. Receiving message that all my classees / entities are not listed in persistence.xml and even after adding them I keep getting the message.

https://snag.gy/T1dRi9.jpg

Follow 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="PrevisaoVendasPU">
    <!-- <non-jta-data-source>java:comp/env/jdbc/GerenciadorAcessoDB</non-jta-data-source> -->
    <provider>javax.persistence.spi.PersistenceProvider</provider>
    <class>br.com.previsao.model.Empresa</class>
    <class>br.com.previsao.model.Endereco</class>
    <class>br.com.previsao.model.Familia</class>
    <class>br.com.previsao.model.Historico</class>
    <class>br.com.previsao.model.Linha</class>
    <class>br.com.previsao.model.Produto</class>
    <class>br.com.previsao.model.Telefone</class>
    <class>br.com.previsao.model.Usuario</class>
    <properties>
        <property name="javax.persistence.jdbc.url"
            value="jdbc:mysql://localhost:3306/previsaovendas?zeroDateTimeBehavior=convertToNull" />
        <property name="javax.persistence.jdbc.user" value="root" />
        <property name="javax.persistence.jdbc.password" value="root" />
        <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />

        <property name="hibernate.show_sql" value="true" />
        <property name="hibernate.format_sql" value="true" />
        <property name="hibernate.hbm2ddl.auto" value="update" />

        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />

        <property name="hibernate.connection.provider_class"
            value="org.hibernate.connection.C3P0ConnectionProvider" />

        <property name="hibernate.c3p0.max_size" value="20" />
        <property name="hibernate.c3p0.min_size" value="5" />
        <property name="hibernate.c3p0.acquire_increment" value="1" />
        <property name="hibernate.c3p0.idle_test_period" value="300" />
        <property name="hibernate.c3p0.max_statements" value="50" />
        <property name="hibernate.c3p0.timeout" value="300" />



        <!-- <property name="hibernate.cache.use_second_level_cache" value="true" 
            /> <property name="hibernate.cache.use_query_cache" value="true" /> <property 
            name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.EhCacheRegionFactory" 
            /> -->
    </properties>
</persistence-unit>

  • By clicking on JPA faces the eclipse created another persistence file . empty xml was just then paste the correct one over :0

  • If you already solved the problem. Put the answer and accept the answer.

2 answers

0


By clicking on the JPA faces to hit the problem, the eclipse created another blank persistence.xml file then just paste the correct one over the top

0

Right-click persistence.xml, then click "Synchronize Class List".

It worked for me (JAVA/JPA)

Browser other questions tagged

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