Erro org.hibernate.InvalidMappingException

1 resposta
blackfalcon

Pessoal esta dando o seguinte erro:

Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource Cadastros/JavaBeans/CadastrarGrupo.hbm.xml
        at org.hibernate.cfg.Configuration.addResource(Configuration.java:671)
        at org.hibernate.cfg.AnnotationConfiguration.addResource(AnnotationConfiguration.java:1134)
        at org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(AnnotationConfiguration.java:719)
        at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1647)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1626)
        at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:1224)
        at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:107)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1600)
        at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:1212)
        at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:107)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1520)
        at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:1194)
        at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:107)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1506)
        at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:1188)
        at Principal.SessionDataBase.<clinit>(SessionDataBase.java:15)
        ... 2 more
Caused by: org.hibernate.MappingException: Could not parse JPA mapping document
        at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:879)
        at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:107)
        at org.hibernate.cfg.Configuration.addResource(Configuration.java:668)
        ... 17 more
Caused by: org.dom4j.DocumentException: Error on line 7 of document  : The element type "property" must be terminated by the matching end-tag "</property>". Nested exception: The element type "property" must be terminated by the matching end-tag "</property>".
        at org.dom4j.io.SAXReader.read(SAXReader.java:482)
        at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:871)
        ... 19 more

O meu hibernate.cfg.xml esta assim:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/mydb</property>
    <property name="hibernate.connection.username">root</property>
    <property name="hibernate.connection.password">123456</property>
    <mapping resource="Cadastros/JavaBeans/CadastrarProduto.hbm.xml"/>
    <mapping resource="Cadastros/JavaBeans/CadastrarGrupo.hbm.xml"/>
    <mapping resource="Cadastros/JavaBeans/CadastrarCliente.hbm.xml"/>
    <mapping resource="Cadastros/JavaBeans/ConfiguracaoLoja.hbm.xml"/>
  </session-factory>
</hibernate-configuration>
CadastrarGrupo.hbm.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
  <class name="Cadastros.JavaBeans.BeanCadastrarGrupo" table="tb04">
    <id name="codigo"/>
    <property name="descricao"/>
  </class>
</hibernate-mapping>

O que pode ser?

Abraços

1 Resposta

blackfalcon

Pessoal dei um limpar e construir, parou de dar o erro.

Vou testar depois se por acaso acontecer alguma coisa, volto aqui.

Abraços

Criado 1 de agosto de 2010
Ultima resposta 2 de ago. de 2010
Respostas 1
Participantes 1