Re:erro no hibernate

4 respostas
D

verifica se ele esta declarado no hibernate.cfg.xml

4 Respostas

C

Coloca na raiz do teu src e faz referencia ele. A propósito mostra o trecho q busca o hibernate.cfg.xml.

raikk0n3n

org.hibernate.HibernateException: br/com/teste/hibernate.cfg.xml not found
o duro q tem este arquivo!!!
o q eu faço???

raikk0n3n

tentei de tudo e naum deu nada

raikk0n3n

é esse

package br.com.teste.sistema.persistencia.dao;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateSessionCreator {
    
    private static String CONFIG_FILE_LOCATION = "br/com/teste/sistema/hibernate.cfg.xml";
    
    //private static final Log log = Log.lookup(HibernateSessionCreator.class);
    
    private SessionFactory sessionFactory;
    
    public HibernateSessionCreator() {
        Configuration cfg = new Configuration();
        cfg.configure(CONFIG_FILE_LOCATION);
        sessionFactory = cfg.buildSessionFactory();
        
        if (sessionFactory == null){
            //log.error("Could not create SessionFactory" );
            throw new RuntimeException("Could not create SessionFactory");
        }
    }
    
    public Session createSession() {
        return sessionFactory.openSession();
    }
    
}

eu alterei para
br/com/teste/sistema/hibernate.cfg.xml e naum deu ainda

Criado 18 de agosto de 2006
Ultima resposta 18 de ago. de 2006
Respostas 4
Participantes 3