How to map Hibernate hbm.xml files to a module in Selena?

Hi,

I have a project with multiple modules, and I can't find a way to successfully describe my hbm.xml files to the Hibernate facets. I have a module called "model" with a conf directory where I keep all my hbm.xml files. I then have a Web module which correctly identified that I was using Hibernate but I see no way to point that facet to my multiple hbm's. I tried adding their root conf directory as source (didn't work), adding them all as "Additional Resources" within the Hibernate facet "General Settings" location (hitting Apply removed them from my Descriptor list), adding the hbm dir as a global library (didn't work), and a bunch of other ways I could think of, to no avail.

The ultimate problem is that the "Persistence Query API Problems" inspection shows errors for all attributes referenced in my Hibernate Query objects

Named query not found
Query parameter not found

Any help would be greatly appreciated. (btw I am using the latest version of everything, not that it matters to the IDE)

Thanks a lot!

PS Been using IntelliJ for years and love it. Great job!

5 comments
Comment actions Permalink

I am a newbie with this stuff also. Is the path containing the .hbm files included as a source directory?

0
Comment actions Permalink

Hello Todd,

I have a project with multiple modules, and I can't find a way to
successfully describe my hbm.xml files to the Hibernate facets. I
have a module called "model" with a conf directory where I keep all my
hbm.xml files. I then have a Web module which correctly identified
that I was using Hibernate but I see no way to point that facet to my
multiple hbm's. I tried adding their root conf directory as source
(didn't work), adding them all as "Additional Resources" within the
Hibernate facet "General Settings" location (hitting Apply removed
them from my Descriptor list), adding the hbm dir as a global library
(didn't work), and a bunch of other ways I could think of, to no
avail.


I'm not sure if I understand your problem completely, but why not simply
add a hibernate facet to your 'model' module?

-tt


0
Comment actions Permalink

I think I was a little off base, actually. The problem seems to be that items referenced in HQL throw Inspection errors:

String hql = "select outNode " +
"from Task t " +
"inner join t.outputNodes outNode " +
"where t.objectId = :taskId " +
(clazz != null ? "and outNode.class = " + clazz.getCanonicalName() : "");
_logger.debug("hql="+hql);
Query query = getSession().createQuery(hql);
query.setParameter("taskId",taskId);

From above, using ":taskId" and then calling

query.setParameter("taskId",taskId);

the Inspection throws errors saying that it "cannot resolve query the parameter" that I just established in the preceding lines. I guess this would be a bug in the Inspector or am I doing something wrong? (I had assumed that the error was related to discovery of the hbm files but that was incorrect.)

Todd

0
Comment actions Permalink

I'm not sure, but perhaps IDEA has trouble parsing that HQL since it's interspersed
with a Java expression..

-tt


0
Comment actions Permalink

Is the problem that it is missing a hibernate facet or maybe the datasource is missing.

0

Please sign in to leave a comment.