Video aulas Neri[resolvido]

3 respostas
D

ola gente estou estudando as video aulas do neri hibernate porem ta dando um erro nesse xml apresenta uma mensagem assim

Erro na insercao : org.hibernateinvalidmappingexception: could not parse mapping document from resource aluno.hbm.xml
quando rodo o programa ta ai o xml abaixo. alguem que ja fez essa video aula do neri sabe arrumar isso?

<?xml version="1.0" encoding="UTF-8"?>

<!--
Professor Neri Aldoir Neitzke - www.informaticon.com.br [email removido]
-->

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
    <class name="Aluno" table="alunos">
       <id name ="alu_codigo" column="alu_codigo" type="integer"/>
       <property name = "alu_name"/>
       <property name = "alu_cidade"/>
       <property name = "alu_fone"/>
       <property name = "alu_curso"/>
    </class>
</hibernate-mapping>

no programa netbeans 6.5
o que aparece de mensagem quando roda é isso alguem ajuda ai pois estou assistindo a fim de estudos para meu conhecimento obrigado.

15 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.1.GA
31 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
31 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
47 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
109 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: hibernate.cfg.xml
109 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: hibernate.cfg.xml
203 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from resource : aluno.hbm.xml
297 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class: Aluno -> alunos

3 Respostas

D

postando a outra xml tambem

-->

<!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.connection.driver_class">
        org.postgresql.Driver
    </property>
    <property name="hibernate.connection.url">
        jdbc:postgresql://localhost/javaHibernate
    </property>
    <property name = "hibernate.connection.username">
        postgres
    </property>
    <property name = "hibernate.connection.password">
        postgres
    </property>
    <property name = "hibernate.dialect">
        org.hibernate.dialect.PostgreSQLDialect
    </property>
   <mapping resource="Aluno.hbm.xml"/>
</session-factory>
</hibernate-configuration>
romarcio

Troca seu Doctype de Aluno.hbm.xml por esse:

&lt;!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"&gt;
E na tag ID ta faltando adicionar o tipo de geração do id:

&lt;id name ="alu_codigo" column="alu_codigo" type="integer"&gt; &lt;generator class="native"/&gt; &lt;/id&gt;

D

obrigada moço tudo certo aqui :wink:

Criado 16 de junho de 2012
Ultima resposta 17 de jun. de 2012
Respostas 3
Participantes 2