hibernate.dialect must be set when no Connection available?

I'm trying to use the HQL console and keep getting: "hibernate.dialect must be set when no Connection available" from all queries.

How do I set the hibernate.dialect for the configured datasources? We normally configure this in an external properties file, the hibernate.cfg.xml file does not hold these values as we use different DB vendors in dev, test and prod. So when I'm looking at a particular dataSource how to I map this dialect value and where?

The persistence tool menus only appears to let me configure naming strategies and datasources. The datasource has not dialect - but this would be the wrong level. The hibernate facet also appears not to have any dialect mappings (which would change with datasource anyway) ? what am I missing?

I'm also wondering why I need to set it when the datasource knows what the DB vendor is, and via that the version. Hibernate should be able to make a pretty good guess at the dialect (is this not automatic?) - what is making us define it?

1 comment
Comment actions Permalink

Ok I think I might have worked out the problem.

This project uses Spring and Hibernate. I had defined a hibernate configuration descriptor in the hibernate facet. I think by doing this it short-circuited the Spring state (?).

After removing all descriptors from the hibernate facet for this module I still see two session factories in the Persistence tool. Confusingly both have exactly the same name and contents, but I think these are picked up from the Spring configuration alone. Attaching a datasource to these and using the HQL tool now works without the exceptions.

I think that was what was going on? the confiuration ad display in IDEA its still confusing, esp with multiple spring modules in the project.

0

Please sign in to leave a comment.