views:

5677

answers:

3

I've installed Hibernate Tools 3.2.4.GA in Eclipse Ganymede. The main driver for installing it was to be able to issue HQL queries interactively.

I have configured all of our mapping files, hibernate.properties, etc. and it shows all of our entities and mappings and is able to read a list of tables from the database. It doesn't appear to use the custom naming strategy I specified in the configuration and therefore I can't query anything. The query in the Dynamic SQL Preview is correct except for table names.

The way I configured the naming strategy was to right click the hibernate configuration and select 'edit configuration' In the 'Options' tab I 'browse' for a Naming strategy. Eclipse is able to find the naming strategy and auto-complete it for me, which would indicate it is in the classpath. I then hit OK and still have problems.

Am I missing something in the naming strategy configuration for hibernate tools (now jboss tools it would appear) or is it broken?

Optionally, is there another tool that I could use (in or out of eclipse) to issue HQL statements against my database and be able to see the results?

UPDATE The problem was in the NamingStrategy implementation. It prepends a string to the front of every table, and changes camel case to all lower case with underscores. Unfortunately, in the implementation, the string is injected via spring, and there is no default set. That spring injection wasn't happening in hibernate tools, and because there was no default, the string was empty. It has been changed to have a default ( which matches our current spring configuration ) and it is working now.

+1  A: 

I didn't use Hibernate Tools in Eclipse. But here is an alternative solution to issue HQL statements against your database.

there is tool called HQE Hibernate Query Editor. Hibernate Query Editor (HQE) is a simple application designed to make easy the work of writting HQL/SQL queries for Hibernate. It has simple features like syntax highlight and other editing stuff.

more information about HQE can be found here https://hqe.dev.java.net/

Ali Abdel-Aziz
good thought... wouldn't start out of the box for me in cmd.exe or cygwin even without me mucking it up with additional configuration.
digitaljoel
+1  A: 

Configure hibernate with myeclipse and you get can various options . This might help http://www.skill-guru.com/blog/tag/hibernate-and-eclipse-tutorial/

vsingh
Your blog entry doesn't reference the hibernate tools plugin at all.
digitaljoel
+1  A: 

You might look into my plugin which can create simple hqls easily. http://fast-code.sourceforge.net/

fastcodejava