Bom, sou um iniciante no Hibertate e não estou conseguindo fazê-lo funcionar, já tentei um milhão de vezes e um milhão de alternativas e nada de resolver
Vou postar os erros
90 [main] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.2.0.Final
96 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.6.1.Final
97 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
100 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
103 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
145 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml
145 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml
190 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: /hibernate.cfg.xml(2) The processing instruction target matching “[xX][mM][lL]” is not allowed.
minha classe de persicistencia é essa:
package java_hibernate;
import javax.swing.*;
import org.hibernate.*;
import org.hibernate.cfg.*;
public class Aluno_Persistencia {
public static void main(String []args)
{
try
{
SessionFactory buildSession = new Configuration().configure().buildSessionFactory();
Session session = buildSession.openSession();
Aluno newStudent = new Aluno();
newStudent.setId_codigo(1);
newStudent.setNome_aluno("Guilherme Santiago");
newStudent.setCidade_aluno("Matutina");
newStudent.setTelefone_aluno("09870988");
newStudent.setCurso("Sistemas de Informação");
Transaction set_Aluno = session.beginTransaction();
session.save(newStudent);
set_Aluno.commit();
session.clear();
}catch(Exception error){
JOptionPane.showMessageDialog(null, "Erro na inserção: "+error);
}
}
}
minha Aluno.hbm.xml
[code]<?xml version="1.0" encoding="UTF-8"?>
[/code]e minha hibernate.cfg.xml
[code]<?xml version="1.0" encoding="UTF-8"?>
org.postgresql.Driver jdbc:postgresql://localhost:5432/javaHibernate postgres crazyforher org.hibernate.dialect.PostgreSQLDialect [/code]desde já agradeço