boa noite a todos!!!
pessoal andei vendo algumas dúvidas parecidas com a minha, mas ainda não consegui resolver apenas consultando, portanto, recorro ao conhecimento de vocês para me ajudarem a resover esse erro( por mera inexperiencia da minha parte, mesmo, assumo)…
eu já fiz esse exemplo uma vez, mas agora, não estou conseguindo mais…
Vamos lá, o hibernate não grava a informação, ele dá o seguinte erro
31 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.1.GA
31 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
47 [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
234 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from resource : aluno.hbm.xml
406 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(15) The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*)".
erro org.hibernate.InvalidMappingException: Could not parse mapping document from resource aluno.hbm.xml
CONSTRUÍDO COM SUCESSO (tempo total: 0 segundos)
quando ele diz “31 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found” diz que a propriedade do hibernate não foi encontrada, mas estão todos no mesmo pacote…mesmo nível
aí vai o config…
<?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/javahibernate</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<mapping resource="aluno.hbm.xml"/>
</session-factory>
</hibernate-configuration>
esse arquivo foi o netbeans que gerou…
segue também, se fizer diferença, o arquivo de mapeamento:
<?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="Aluno" table="alunos">
<id name="alu_godigo" column="alu_codigo" type="int" />
<id name="alu_nome" column="alu_nome" type="String" />
<id name="alu_cidade" />
<id name="alu_telefone" />
<id name="alu_curso" />
</class>
</hibernate-mapping>
que também parece estar certo…
bom, moral da história, o que tá de errado nesse cfg???
Obrigado a todos pela ajuda!!
Grande abraço!!!
Horácio