Caro amigo.
Estou com um problema “primário” com o hibernate (Core e Annotations), onde não estou conseguindo resolver a seguinte mensagem de erro:
The project was not built since its build path is incomplete. Cannot find the class file for org.hibernate.MappingException. Fix the build path then try building this project.
The type org.hibernate.MappingException cannot be resolved. It is indirectly referenced from required .class files.
Já coloquei os .jar´s do hibernate no meu projeto (Java Build Path -> Libraries -> Add External JARS…)
Abaixo segue um código de exemplo no qual esta ocorrendo o erros acima:
package br.com.softwork.hibernate;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
/**
* @author Dennys dos Santos Sobrinho
*
*/
public class HibernateFactory {
private static [b][u]SessionFactory[/u][/b] factory;
static {
AnnotationConfiguration cfg = new AnnotationConfiguration();
[b][u]cfg.addAnnotatedClass(Produto.class);[/u][/b]
cfg.addAnnotatedClass(Categoria.class);
factory = cfg.buildSessionFactory();
}
public [b][u]Session[/u][/b] getSession() {
return factory.openSession();
}
}