views:

25

answers:

1

I've managed to connect from eclipse Hibernate Tools to my MySql Database used with grails, classes mapped by GORM.

Now I'd like to perform HQL queries on the DB using the Hibernate Tools. However Hibernate Tools tells me for every table that it is not mapped.

My question: Do I really need to write all the class mappings manually into a hibernate.cfg.xml file or is there a way to get it from grails? I mean grails / GORM needs to have an idea about the mappings, right? Or am I going for this the wrong way?

P.S. I know there is a script grails-create-hibernate-cfg-xml, but this only creates a dummy file for some Books class...

A: 

Grails has convetions based config so there is no hibernate.cfg.xml but you can easily execute HQL queries int groovy console - just call

grails console

It will open Groovy console connected to your app so you can write groovy scripts interacting with your DB.

Olexandr