So I’m taking this web apps course, where we’re making use of Apache Tomcat, J2EE, and generally learning how to employ the MVC framework in a modern web application (which we call “Fakebook”. Yeah I know, lollercoptorz, rite?). On the first three homework assignments, I have collectively received: 103, 100, 100. So I figured, on this fourth assignment (and with 34+ hours of built-up “penalty-less late time” with which to turn in the assignment), I had a little elbow room to experiment.
I decided to use the Struts2 and Hibernate frameworks.
Yeah, insane. Especially the latter, considering I have ZIP/ZERO/NADA/ZILCH experience with either one.
It took about a day to get the hang of how Struts organizes the MVC framework. The most difficult part, as usual, was setting up the XML configuration file. Luckily, it doesn’t require too many dependencies and is fairly straightforward to install and incorporate. It took another day to figure out the notion of Interceptors for the purpose of implementing authenticated resources, and also installing a database schema when the server was started.
Then came Hibernate. Holy Halloween, Batman.
This is seriously the most complex framework I have ever worked with. Each “module” beyond the core requires a heinous number of dependencies, some of which are optional, and woe is you if you mess them up. Supposedly v2.5 will incorporate a lot of the dependencies into a single package, but that’s still in Beta as of this post.
Maven can be effectively used to mitigate some of the difficulties in satisfying dependencies, but it’s still largely up to the user to figure out what packages are required if you want to use the Core, Search, or any of the other “modules.”
Once the dependencies are satisfied, then the real fun begins: configuring Hibernate.
The number of configuration options is mind-boggling; I feel like I’m installing Gentoo. I ended up making a post on StackOverflow when I reached a point where I could actually attempt flipping the “on” switch, and was greeted by cascading 50-level exceptions. The single response ended up being the right one (it was a simple “class” configuration option I thought wouldn’t have any effect, since – let’s face it – I have no idea what half the specified configuration options do, and the documentation isn’t much help), though it only revealed yet another exception.
Fixing that yielded another, and so on, and so on…literally at least a dozen more exceptions that were somewhat more straightforward, but revealed 1) just how little I knew how to use Hibernate, and 2) how so many different configuration options need to be perfectly specified for the damn thing to work.
But as of about an hour ago, I am proud to say that after three days of pouring through PDF documentation, Googling the hell out of phrases like “hibernate arrays” and “one-to-many hibernate exception” and “WHY WOULD ANYONE EVER USE HIBERNATE”, banging my head on the desk when the editor swore I had a phantom error in my XML config file, and satisfying concrete and transitive dependencies, my server BREATHED today by successfully executing an action within the Struts framework, which also contained a database access through Hibernate.
It’s WORKING. It’s ACTUALLY WORKING. HOLY CRAP. …and it’s due by 11:59pm tonight. WHEEE.
Also, I wanted to give a shout-out to my main man V2 (my MacBook), for whom earlier this week I purchased a new battery after the previous one lasted 511 recharge/discharge cycles without ever offering less than 2+ hours of continuous use. Interestingly, the battery was beginning to bow outward (never a good sign) around the same time that OS X itself informed me that the battery needed to be replaced “soon”. So after more than three years and well over twice the average lifespan of these batteries, I dropped $130 on a new one.
V2 paid for himself a long, long time ago. The new MacBook Pros are certainly the sexiest ones to hit the market so far, but this guy is a trooper. I purchased him in September of 2006, and the only expenditures I’ve had are a $150 mainboard/DVD drive/Bluetooth repair job, a $200 hard drive/RAM upgrade, and now a $130 battery replacement. Not too shabby at all for three years (and I didn’t even purchase the extended warranty!).
Anywho. Busy weekend ahead. I’ve had several more interviews, many of which have gone exceedingly well, and PhD and fellowship applications are going smoothly. Two big assignments due this week, lots of research work to be done over the weekend, and Cathryn will also be in town tomorrow night. 🙂
You described the initial hurdle of ripping out strips of grey matter off your brain and laying them in front of the cave to lure the monster out of hiding.
After that party, the real job begins.
I may have it easier using the Entity Framework for ORM. The down side is that I’m taking a hit of 5x-7x the resource consumption of Hibernate without any tweaks. And that’s no exaggeration.
Big surprise it’s from Microsoft.
Fun fact:
My Acer battery lasts 7 whole minutes now. 😉
Yeah, since it’s only a little teeny social networking app that won’t be used by anyone outside of myself and my TAs, I figure performance isn’t that big of a deal.
I mean, if I end up commercializing it, then sure 😛
Struts2 wasn’t too bad…but Hibernate kicked the living bejeezus out of me. Seriously. It was like wading through a pool of molasses on a cold day.
But yes, at least it wasn’t from Microsoft; and armed with my brand-new MacBook battery, I was getting better-than-ever usage out of it! 😛
Pingback: It’s the most wonderful time of the year « Theatre of Consciousness