MappingNotFoundException when running queries in Hibernate Console

I'm trying to run HQL queries in the Hibernate Console. I've added the datasource to the Data Sources view and added my hibernate.cfg.xml to the Hibernate facet such that in appears in the Persistence view. The content of hibernate.cfg.xml is:

    <?xml version='1.0' encoding='utf-8'?>
    <!DOCTYPE hibernate-configuration PUBLIC
            "-//Hibernate/Hibernate Configuration DTD//EN"
            <property name="connection.url">jdbc:mysql://localhost/mmanager</property>
            <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
            <property name="connection.username">root</property>
            <property name="connection.password">password</property>
            <property name="dialect">com.puca.core.util.db.MySQLInnoDBDialect</property>
            <!-- mapping files -->
            <mapping resource="com/puca/messagemanager/api/model/XmlApiDlrMapping.hbm.xml"/>

The `.hbm.xml` is shown in green, whereas if I change it to a file that doesn't exist it is shown in red, so it seems that IntelliJ can find it. However, if I run a simple query in the console like:

    from XmlApiDlrMapping xmlApiDlrMapping
    where xmlApiDlrMapping.retries = 5

I get an error:

    java.lang.RuntimeException: org.hibernate.MappingNotFoundException: resource: com/puca/messagemanager/api/model/XmlApiDlrMapping.hbm.xml not found
        at org.hibernate.cfg.Configuration.addResource(
        at org.hibernate.cfg.Configuration.parseMappingElement(
        at org.hibernate.cfg.Configuration.parseSessionFactory(
        at org.hibernate.cfg.Configuration.doConfigure(
        at org.hibernate.cfg.Configuration.doConfigure(
        at org.hibernate.cfg.Configuration.configure(

I'm using IntelliJ 10.5.4.



Looks like .xml mapping does not get into the classpath. Try to rebuild the project explicitly and restart the console.

I usually test the correctness of Hibernate configuration with dummy application like:

public class PingQL {
    public static void main(String[] argv) {
        SessionFactory factory = new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();
        Session session = factory.getCurrentSession();
        List list = session.createQuery("from MyTable").list();
        System.out.println(MessageFormat.format("list.size(): {0}", list.size()));

If its response is the same to console, then the problem is in the configuration.