Sad, sad, news today: Pink Floyd’s Barrett dies aged 60. He had a tragic life, yet produced some of the most beautiful music I have ever heard.
Shine on…
Sad, sad, news today: Pink Floyd’s Barrett dies aged 60. He had a tragic life, yet produced some of the most beautiful music I have ever heard.
Shine on…
In the same way that we’ve been checking out web frameworks for Java, we’ve also been looking at persistence layers. Despite strong recommendations for iBatis, we’ve ended up going for hibernate, largely because “it’s what everybody else uses”… So I’m learning my way around Hibernate, aided by the Hibernate In Action book. Now the book seems quite reasonable so far at explaining why Hibernate is so damned complicated (this is my 3rd ORM I’ve used, yet it still seems weird and bloaty). My pain starts when I get to the second chapter, where the code starts.
The main problem is that the very second example comes unstuck. The first line is:
Session session = getSessionFactory().openSession();
Where is this magical getSessionFactory()
coming from? Looking it up in the index sends me to page 314, smack into the middle of the “the session façade pattern”, where an implementation that probably won’t work for me sits. Thankfully, I can spot the obvious bit:
new Configuration().configure().buildSessionFactory();
But why on earth dont they put this in chapter 2 where it belongs? I’ve got code sitting in front of me that I can’t run, and that’s a crime.
Oh, on top of that, turning the page reveals the phrase “the code fragment prints…”. Well, it would if I had a hibernate config file to go with the mapping file that they presented. What a waste of my time figuring all this out. I’m just glad I didn’t pay for this book (work did).
Alright, turning a few pages further on we get to “Creating a SessionFactory”. That’s better. But there’s still no excuse for code samples you can’t run.
After much gnashing of teeth and wailing, we’ve finally found a web framework for Java that looks usable. Stripes looks simple enough to be usable without requiring insane amounts of configuration. It also uses Java 5 features like annotations and generics to great effect. Plus, minimal configuration files. I strongly recommend checking out the Quick Start.
It’s not rails (by a long shot), but seeing as how we are forced to use Java at work, it seems to be one of the least unpleasant options so far.