Showing posts with label bug. Show all posts
Showing posts with label bug. Show all posts

2007-11-29

Working Grails and JPA... troubleshooting

I've been working with Grails and the JPA. In eclipse I use the Hibernate3 reverse engineer tool. To make that work I use a hibernate.cfg.xml file that I place in my project's top level folder and a hibernate.reveng.xml file also in the top level folder. I then ask the tool to create EJB3 annotated POJOs and drop them into my grails project.

Previously, I had been deleting the hibernate.cfg.xml and hibernate.reveng.xml files out of the project but yesterday I forgot to do that. What happens if you leave these extra files in your project is that none of the JPA objects get mapped and are therefore invisible to your GORM.

It turns out GORM is reading the top level hibernate.cfg.xml file so why would it see those classes? I never mapped the EJB3 entity beans in the hibernate.cfg.xml I was using for reverse engineer. So, no surprise. There won't be an error either because there were no hibernate errors. The GORM was working perfectly well against the hibernate.cfg.xml in the top level directory.

Now you might wonder why I have two different hibernate.cfg.xml files? Well, the answer is that I need different configurations for the running environment and for the reverse engineer environment. That might be peculiar for me.

Is this a bug? No, not really. It was very hard to diagnose because of the lack of output. Even turning all the logs wide open produced no problems. It wasn't until I went through the project and reverted it to an old version then added one change at a time to it that I noticed the problem was related to the extra hibernate file. At least I know to watch for that now.

2007-09-08

Groovy Grails Portlet

I need to put my grails applications in a Portal. If you look at Bug 1345 over at codehaus you can see I'm not the only one. Now Spring will run in a Portlet... Grails is built on Spring... how hard could it be? I might write a portlet adapter myself.

2007-08-13

Hibernate3 evil bug

The version of hibernate that I'm using has this bug. I had one query in my code base with " foo =: bar " instead of " foo=:bar " and all my JUnit tests started failing. Remarkable that something so small and silly could destroy an entire code base. There is no warning in the trace to point you toward this syntax... a single space blows up your whole project... evil... just pure evil.