Tuesday, July 1, 2008

Keeping it simple

A teammate asked for help on a problem he was having. He was using Hibernate to retrieve data from a table, and wanted to retrieve a character column (Y,N) as a Boolean. His first thought was to the @Type annotation. He also considered setting the hibernate.query.substitutions property.

When he asked me for help, both of these solutions seemed quite complicated for his problem. I asked about retrieving the data as a String, but he said he tried and that it did not work. He was stumped. I was skeptical. I was sure there was a simple way to get this to work.

He changed his model to represent the data as a string, reloaded the system, and showed me the error he was getting. When we followed the stacktrace back to the line that was causing an error, I noticed that the model being retrieved was not the one he as changing. He had two similarly-named models, and was changing one while testing the behavior of the other.

These questions came to mind:

  1. Why wasn't he pairing while working on this task?
  2. Why were the models similarly named?
  3. Why did he need to reboot the system? Why wasn't there a quick integration test written?