Until recently, I had never written Java 1.5 specific code. For technical and political reasons, it had to run on 1.4 jvms. I was also not familiar with web frameworks since maybe 2005.
I was making a web app to manage database information, and I decided to use a modern web framework to make myself “more productive”. Ha! They all seemed to use hibernate. I eventually decided to use Grails.
I also decided to use Annotations to handle the data descriptions. The JBoss Tools had hibernate support, and WST (I think) had JPA support. The first annoying part was that Eclipse expects you to create a new project to get JPA or hibernate support. I ended up merge .project files to get support for both.
The JPA tools are marked 1.0, but I don’t think they are ready for prime time. I got a lot of null pointer errors, but never got a backtrace in the error dialog to help me figure out what might be the problem. I got lots of “persistence.xml not found” errors. I move the persistence.xml file to various places in the project with no success. Eventually I edited the file with vi and discovered that it didn’t end with a newline. Adding one at least made it loadable. I never did get anything in my database.
Hibernate3 also supported use of annoations, but I never could put all of the pieces together correctly. The documentation was pretty patchy, odd things happened, and the error messages cryptic. I never found a single location for the hibernate.cfg.xml that made Eclipse, Maven and runtime happy.
I should have switched back to the older hibernate methods, but I was too stubborn. I wanted make it work the shiny new way at any cost, but it soon reached the point where it didn’t matter any more. Sometimes stubborness and persistence are good; sometimes it’s a character flaw.
The combination of a newbie and imperfect tools and documentation made me shoot myself in the foot. Next time, I’ll quit hitting my head against the brick wall earlier. I hope.