Hibernate, Get Out of My POJO!

June 21, 2006

If you do a Google search on Hibernate, you are bound to find a rather large bag of posts on the infamous lazy loading exception that Hibernate produces as part of its lazy fetching strategy. The output of this exception is typically in the form:

org.hibernate.LazyInitializationException: failed to lazily initialize a collection - no session or session was closed

A majority of the time, the error is on the part of the programmer, who did not take the time to understand the Hibernate API and attempted to perform an illegal operation given the resources that were available to Hibernate at the time of the call. Most of the time, but not all of the time.

In fact, my colleagues and I have come across a number of instances in our current project when we need to purge all Hibernate-specific references from our POJO. In this particular case, our goal is to get back to the native collections and object references so that client code can walk the object, processing the current set of data that it offers. We don't want to risk the chance of bumping into this nagging exception when we no longer have a need for its services.


Posted at 01:09 AM in Java | Permalink Icon Permalink | Comment Icon Comments (70)

Taking the 'dist-upgrade' Plunge

June 04, 2006

I'm not afraid anymore! Afraid of what? I'm no longer afraid of upgrading Linux. Perhaps it can be attributed to the conditioning I received as a user of non-debian distros, but, undoubtably, I dreaded having to upgrade my Linux installation. Moving to the next release of a distro used to mean backing up my entire home directory, perhaps cleaning out any desktop settings I didn't want to carry over, formatting my harddrive, and basically starting from scratch. This whole process would usually take an entire weekend, and a couple of late nights in the beginning of the week until I was back in my comfort zone, having explored all the new offers along the way.

One phrase comes to mind that has perhaps already been coined, but continues to prove itself time and again.

Once you go Debian, you never go back.

As a user of Ubuntu, I had the opportunity to size up the rumors and attempt to upgrade my distro by simply executing:

apt-get dist-upgrade

I was a little nervous when I hit the "OK" button to begin, but I kept saying to myself, "Ubuntu hasn't let me down yet!" I went for it...and it worked! In a little under two hours (mostly consumed by download time) I had migrated from Breezy Badger to Dapper Drake.

There are a couple of things that Ubuntu has done to make this process seamless. To begin with, the Ubuntu distribution offers a one-click GUI that automates the process of changing the repositories to point to the new release and kicking off the upgrade process. Previously, this involved manually editing the /etc/apt/sources.list file and then executing the apt-get dist-upgrade command. In addition to this interface, there is a dialog window that presents the differences that were introduced in any system configuration file since its installation. This step protects you from losing any settings you might have forgotten that you made to your system, and an opportunity to back them up before they are trampled.

As a Mandrake user, I can remember criticizing Debian for having an ugly, text-based installer. Even though Ubuntu has now rectified that situation in Dapper Drake, I found that it didn't even matter. If done right, the installation of Debian happens exactly once, and from then on, the distro continuously matures via the magical workings of dist-upgrade.

Posted at 06:43 PM in Linux | Permalink Icon Permalink | Comment Icon Comments (3)

Fixing Maryland Traffic

June 04, 2006

A while back I received a postcard in the mail asking how I would solve the Maryland Route One traffic problems. Given that all I seem to complain about is the traffic in this area, I felt obliged to respond. Below is the letter I wrote to the task force. Hopefully my ideas will align with other voters in the area and we can start to see some motion in the battle to solve this serious issue.

Members of the Route One Task Force,

I want to start off by relating how pleasantly surprised I was to receive the "Route One Task Force" postcard in my mailbox and to know that an initiative to improve the situation is underway. While there are always many problems to tackle, there is no question that traffic in this area is the most significant in the minds of the metro-area working force. Discussions of traffic congestion take center stage in discussions at every social event I attend and the level of frustrations are always high.

For over two years, I rode the metro/MARC train to my job in the district. Riding the metro allowed me to save money on gas, avoid accidents, rest on the way home from work, and be productive when I found myself in a pinch. However, when I took a new job in Bethesda, riding the metro was no longer an option.

Each morning I fight through 495W into Montgomery County. Doing so makes me tired, irritable, wastes gas (not to mention the emissions), and puts me in danger of having an accident. If it were available, I wouldn't even think twice about riding the metro. However, there is no way I am going to take the green line all the way into downtown D.C. just to get on the red line out to Bethesda. It would simply take too long. There isn't a person I talk to that opposes the idea of a purple line. In fact, many conversations I have had concluded that it was a huge oversight not to build it originally.

Having grown up in the area, I am very well aware of the history of the Intercounty Connector (ICC). It certainly isn't an awful idea as there is currently no direct way to get over to I-270 from the Laurel area. I lost track a long time ago the number of times I have passed by an ICC sign while meandering back and forth across the middle Maryland area. However, as ideal as it might sound, mass transit is a much better solution in the long run. The fact that the D.C. metro can only take you to one of the three airports in the area is flawed. Additionally, one has to question why the metro only has two tracks, limiting the number of trains it can carry at one time.

I strong encourage you to continue to find ways to solve the traffic problems in the area by reducing the number of vehicles on the roads.

Posted at 05:48 PM in General | Permalink Icon Permalink | Comment Icon What, no comments?