Thursday, August 14, 2008

Lazy Fetching, Sequences, iPhone

So life is very busy right now at work... so many things to do, not enough people to do them. I've been working very hard on our Accounting system lately. I've largely gotten this application converted to Hibernate but there are still areas that need to be converted. One notable change this week was my strategy on handling hibernate sessions.... after realizing that I had to enable lazy fetching the question was how do I manage the sessions so that the data can be retrieved whenever needed? I decided to take the route of one session per panel and that seems to be working. It was a lot of work, all data action methods needed to be changed to accept a session parameter among tons of other changes. Another cool thing I did related to lazy fetching is that on Vendor/Customer list panels the the addresses and contacts are retrieved as the user scrolls down the table! This is achieved in the table model by setting the address & contact column values in the getValueAt method. Therefore only the displayed rows are set and then when the user scrolls the getValueAt method is called which sets the address/contact columns for the newly displayed rows. Very cool huh?

Another notable task this week was sequences.... I wrote a pretty complex method which gets the last reference number for a document, finds the last run of numbers in a String (the String can have any characters), increments this number, and then reinserts this number back into the String replacing the old number without misplacing any other characters.

I'm getting an iPhone this week y'all!! It shipped today and hopefully should arrive at the AT&T store on Saturday. I like my iPod touch but I'm looking forward to having an iPhone where I can get email, surf, etc from anywhere, make calls, you name it. The iPod touch is fun till you don't have wifi and then to it gets kinda useless.

No comments: