code prole

Icon

coding for the proletariat since 1977

Hibernation

In an effort to learn the layered framework in place at my current client I am constructing an application of my own. It won’t be very complex in terms of functionality that the user sees, but it will span several new (to me) technologies.

Starting at the bottom with the database and persistence layer I am diving into hibernate again. Over the winter I read the excellent “Hibernate: A Developers Handbook” as a way of getting my feet wet. Today I was able to reconstruct the knowledge gained and rapidly put together several mapping (hbm.xml) files. Using some nifty Ant targets possible through the tools extension to hibernate I was able to generate not only the data access objects (DAO) but also the database schema itself. Make a change to the mapping and it is a simple thing to regenerate both.

I probably won’t regenerate the java code again, now that I’m happy with the basic structure of the DAO. The HBM2Java utility wants to make the classes serializable; which isn’t necessarily a bad thing, after all you may want to pass the object around in your http session. However, I’m still learning Java and all of its intricacies; messing around with the required setup of UUIDs is more than I want to take on. (Heck, I’m not even sure if I understand the process of setting the UUID.)

Next up will be the application interface layer. This will allow me to explore Java Server Faces (JSF) and give me a way to test out the hibernate stuff at the bottom. I’ll fill in the middle with Spring later.

Advertisements

Filed under: Hibernate