Estava inciando no hibernate,e encontrei esse erro,pelejei mas naum conseguir resolver,queria so o pessoal dava uma força.
[size=18]Erro[/size]
12 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.0.SP1
21 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
24 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
28 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
71 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: java_hibernate/hibernate.cfg.xml
71 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: java_hibernate/hibernate.cfg.xml
113 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: java_hibernate/hibernate.cfg.xml(1) The processing instruction target matching "[xX][mM][lL]" is not allowed.
[size=18]hibernate.cfg.xml[/size]
[code] <?xml version="1.0" encoding="UTF-8"?>
org.hibernate.dialect.MySQLDialect
com.mysql.jdbc.Driver
jdbc:mysql://localhost:3306/scp
root
admin
<mapping resource="java_hibernate/Classes.hbm.xml"/>
</session-factory>
</hibernate-configuration>
[/code]
[size=18]Classes.hbm.xml[/size]
<?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="java_firebird\Classes" table="classes">
<id name="controle" column="controle" type="int">
<generator class="increment"/>
</id>
<property name="des" column="des" type="string"/>
<property name="qtdc" column="qtdc" type="int"/>
</class>
</hibernate-mapping>
[size=18]GravaClasses[/size]
[code]package java_hibernate;
import javax.swing.JOptionPane;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.*;
public class GravaClasse {
public static void main (String [] args){
try{
SessionFactory sf= new Configuration().configure("java_hibernate/hibernate.cfg.xml").buildSessionFactory();
Session sessao= sf.openSession();
Classes classe=new Classes();
classe.setControle(190);
classe.setDes("TOURO BANDIDO");
classe.setQtdc(59);
Transaction tst=sessao.beginTransaction();
sessao.save(classe);
tst.commit();
sessao.clear();
}catch(Exception erro){
JOptionPane.showMessageDialog(null, erro);
}
}
}
[/code]