Image

Imagetrajano wrote in Imagejava_dev 😡grumpy

Learning Hibernate and HSQLDB

Actually it wasn't for me, I was basically helping a friend out getting his HSQLDB working in Eclipse. I have no clue what kind of documentation he was reading but what threw me off was "install the plugin" was the one that threw me off. Anyway I wrote him a quickie JDBC app that uses an in-memory database. Of course I didn't write it properly the first time around, I just wanted it to create the table and give me data.

Once I did that I cleaned up my sample code to ensure I close any open resources, like a good citizen. Which added to the code bloat. Especially with the if (xxx != null) checks in the finally block.

I think its insane for people to write their own persistence framework or use straight JDBC for their projects. Considering the amount of clean up that you would have to do for one thing.

So just to keep my sanity, I relearned and expanded my Hibernate knowledge. The cool new thing I learned was the SchemaUpdate utility which updates the schema for me (which I also found that I can do more easily with a property that I can set later on in the morning). This is good because I hate having to create DDLs. And it supports incremental changes too.

Now for my gripe. I really really hate having to create getters and setters and equals and hashcode for the domain objects. Its really annoying that I would even have to do that. Unfortunately the only way I can think of getting someting like this implemented is to use MDA with AndroMDA to generate the persistent bean code. Which I am trying to avoid because I find it harder to version control a model than source files, especially when merging changes.

Wonder if anyone else feels the same way.