views:

213

answers:

0

I'm trying to use the HQL Console feature of Intellij IDEA for interactively debugging HQL. We use JPA with Hibernate as the provider.

I've configured the JPA Facet for the module as per this, as well as a DataSource. The HQL console seems to know about my entities, as it can auto-complete them in the console. But whenever I try a query it fails with:

Session is not created
Query is not prepared

A colleague suggests that the issue is somewhere in the "make your hibernate console talk to your database" realm, which sounds correct. But I can use the SQL console configured to the same DataSource and perform SQL queries just fine. I just can't get it to work from the HQL console.

Update: I've determined that the session is not being created because of the following:

@OneToOne or @ManyToOne on com.example.model.JournalRole.journal references an unknown entity: com.example.model.Journal

Most of our entities are defined using JPA annotations, except for a small handful of classes that we have defined via *.hbm.xml files. I tried manually specifying these files in my persistence.xml, but it still can't seem to resolve them. The mapping files reside right along the java source files in src/main/java/com/example/model.

I have tried adding the following to my persistence.xml:

<mapping-file>Journal.hbm.xml</mapping-file>

along with many variations of relative and absolute paths, but it still cannot resolve the mappings for Journal, or any of my other hbm.xml files.