2
I am trying to make a small interaction with the Mysql database but when I run the test class appears the following error:
Exception in thread "main" java.lang.Nosuchmethoderror: org.hibernate.cfg.Mappings.(Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/List;Ljava/util/List;Lorg/hibernate/cfg/NamingStrategy;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;) V at org.hibernate.cfg.ExtendedMappings.(Extendedmappings.java:43) at org.hibernate.cfg.AnnotationConfiguration.createExtendedMappings(Annotationconfiguration.java:125) at org.hibernate.cfg.AnnotationConfiguration.addAnnotatedClass(Annotationconfiguration.java:94) at test.main(test.java:13)
Follow the connection codes:
package com.cavalcanteTech.dao;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
/* @author Emanuel Cavalcante*/
public class HibernateUtil {
    public static final SessionFactory session = buildSession();
    private static SessionFactory buildSession() {
        try {
            Configuration cfg = new Configuration();
            cfg.configure("hibernate.cfg.xml");
            return cfg.buildSessionFactory();
        } catch (Throwable b) {
            System.out.println("Não deu \n" + b);
            throw new ExceptionInInitializerError();
        }
    }
    public static SessionFactory getSessionFactory() {
        return session;
    }
}
Just follow my lead:
package com.cavalcanteTech.modelo;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
/* @author Emanuel Cavalcante*/
@Entity
public class Cliente {
    @Id
    @GeneratedValue
    private long id;
    @Column(name = "nome")
    private String nome;
    @Column(name = "endereco")
    private String endereco;
    @Column(name = "telefone")
    private String telefone;
    @Column(name = "dataDePagamento")
    private String dataDePagamento;
     //gets e sets
}
My class, my clientele:
package com.cavalcanteTech.dao;
import org.hibernate.Session;
import com.cavalcanteTech.modelo.Cliente;
public class ClienteDao {
    private Session session;
    public void Inserir(Cliente cliente) {
        session = HibernateUtil.getSessionFactory().openSession();
        try {
            System.out.println("Passou1");
            session.beginTransaction();
            System.out.println("Passou1");
            session.save(cliente);
            System.out.println("Passou1");
            session.getTransaction().commit();
        } finally {
            session.close();
        }
    }
}
Now, my class running the test:
import org.hibernate.Session;
import org.hibernate.cfg.AnnotationConfiguration;
import com.cavalcanteTech.dao.ClienteDao;
import com.cavalcanteTech.dao.HibernateUtil;
import com.cavalcanteTech.modelo.Cliente;
public class teste {
    public static void main(String[] args) {
        AnnotationConfiguration cfg = new AnnotationConfiguration();
        cfg.addAnnotatedClass(Cliente.class);
        Cliente cliente = new Cliente();
        ClienteDao dao = new ClienteDao();
        cliente.setDataDePagamento("3213");
        cliente.setEndereco("312321");
        cliente.setNome("432432");
        cliente.setTelefone("321312");
        cliente.setId(1);
        System.out.println(cliente.toString());
        dao.Inserir(cliente);
    }
}
My libraries used in the project:

I have looked for this error in several places, but so far I could not solve, if someone knows what I am doing wrong, I thank you already. : D

Then I remove the hibernate3-3.2.4.sp1.jar and add the Hibernate-core-4.3.8.Final. jar, theoretically it’s for all right?
– emanuel cavalcante
Replaces and appears this error: Caused by: java.lang.Classnotfoundexception: org.hibernate.Annotations.common.Reflection.Reflectionmanager at java.net.Urlclassloader$1.run(Unknown Source) at java.net.Urlclassloader$1.run(Unknown Source) at java.security.Accesscontroller.doPrivileged(Native Method) at java.net.Urlclassloader.findClass(Unknown Source) at java.lang.Classloader.loadClass(Unknown Source) at sun.misc.Launcher$Appclassloader.loadClass(Unknown Source) at java.lang.Classloader.loadClass(Unknown Source) ... 1 more
– emanuel cavalcante