classpath issue with hibernate console

Hi there,

i am using idea10.5, ultimate.

any query I throw at the HQL console, I get java.lang.RuntimeException: org.hibernate.MappingNotFoundException: file: XXXXX.hbm.xml not found

the autocomplete works though.

the hibernate.cfg.xml session factory is mapped to a data source. (the same datasource works fine with sql console).

if i manually copy the hbm files to a source folder for instance it works. I am using maven2 to build my projects (works fine) but I also went through external libraries, all libraries that contain hbm files above are present there.

thanks for any idea on how to fix this..

also, is there any documentation on how the ql console can be used? can I use for instance criteria/restrictions with it and if yes how?

--val

3 comments
Comment actions Permalink

I got this partially working with jpa-ql console (all queries work now). i created a facet with a simple persistence.xml with only jdbc connection params and path to hibernate mapping file.

Entity/field autocompletion doesn't work though, the same as the ER diagram -- which both still work with pure hibernate facet and hql console (sic!).

0
Comment actions Permalink

I, too, am having classpath problems with the Hibernate Console in 10.5 Ultimate. However, mine manifests like this:

In the Persistence Tool window, I have a web | DataSessionFactory created as a result of scanning the Spring files for a datasource. I first created a Hibernate Beans file set in the Spring facet that includes all Hibernate-related beans. (Interestingly, the Persistence tool window does not show the Spring facet, which I thought the Help docs said would be there. This was my first sign something was maybe not right.)

From the Persistence window, I opened a Query Console. In the query cosole, I got a hql> prompt, which was a promising sign.

However, when I enter the simplest of Hibernate HQL queries, something like from com.acme.Foo, I get a java.lang.ClassNotFoundException indicating com.acme.Foo is not found.  Of course the class is on my build classpath (it's in a source content declared for the module).

Honestly, I've never used the Hibernate Console, so I'm inclined to believe I've mucked up some configuration. I saw this thread, so thought I'd pile on.

jack

0
Comment actions Permalink

ever since i posted this,  jpa-ql console works ok for me. still miss the autocomplete i get with hql mode but at least it works.

in order to create that, you have to add jpa faceting to module, this will create an empty persistent.xml file.

you can map hibernate, this is all i have in mine:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
    <persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
        <properties>
            <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/>
            <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost/xxx"/>
            <property name="javax.persistence.jdbc.user" value="xxx"/>
            <property name="javax.persistence.jdbc.password" value="xxx"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
            <property name="hibernate.ejb.cfgfile" value="hibernate.cfg.xml"/>
        </properties>
    </persistence-unit>
</persistence>

now in the above jpa facet configuration you have to add a datasource to the persistence unit (in my case "test"). the same name will show up in the persistence tool window and QL console is also enabled. clicking on it will prompt you to choose between hql or jpa console, the latter works for me.

0

Please sign in to leave a comment.