为什么我得到org.hibernate.MappingException:配置无效?

时间:2013-12-11 20:41:58

标签: java hibernate

我有一个hibenate cfg文件,但当我尝试在我的应用程序中使用hibernate时,我得到:严重:Ocurrióunerror enlainicializacióndela SessionFactory:org.hibernate.MappingException:invalid configuration

这是我的hibernate.cfg.xml:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration SYSTEM
    "classpath://org/hibernate/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>

        <!-- parametros para la conexion a la base de datos -->
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="connection.url">jdbc:mysql://localhost:3306/mydb</property>
        <property name="connection.username">root</property>
        <property name="connection.password">root</property>

        <!-- Configuracion del pool interno -->
        <property name="connection.pool_size">50</property>

        <!-- Dialecto de la base de datos -->
        <property name="dialect">org.hibernate.dialect.MySQL5Dialect</property>

        <!-- Otras propiedades importantes -->
        <property name="show_sql">true</property>
        <prop key="hibernate.format_sql">true</prop>  

        <!-- Archivos de mapeo -->
        <mapping class="com.proximate.model.Usuarios"/>
    </session-factory>
</hibernate-configuration>

这是我的hibernate util:

public class HibernateUtil {

    private static final SessionFactory sessionFactory;

    static {
        try {
            sessionFactory = new Configuration().configure().buildSessionFactory();
        } catch (HibernateException he) {
            System.err.println("Ocurrió un error en la inicialización de la SessionFactory: " + he);
            throw new ExceptionInInitializerError(he);
        }
    }

    public static SessionFactory getSessionFactory() {
        return sessionFactory;
    }

    public static void close() {
        sessionFactory.close();
    }
}

我的配置出了什么问题??? 提前致谢

0 个答案:

没有答案