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.
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. 🙂