Featured Post

The great debacle of healthcare.gov

This is the first time in history when the president of the United States of America, or probably for any head of state around the world,...

Thursday, November 27, 2008

Be cautuios while using auto boxing and unboxing feature of Java 5

We recently migrated to Java 5 and started using the great auto boxing/unboxing feature of it. I've one method in a class that returns boolean primitive and I required to override it. I was so excited with this boxing feature that I started saving some lines of code by evaluating and returning the Boolean object directly. And when the code I started testing, had started throwing NullPointerException here and there. I got confused for sometime and took a little to understand while what happening there. Becuse the Java 1.4 debugging mindset was looking for a object that was accessed (using dot) but I didn't find any code that can cause that NPE. Then I realized that it is the Boolean object that was getting evaluated to primitives (actually Boolean.booleanValue() was invoked implicitely) and that is causing this NPE.

In prior to Java 5, as of my knowledge, this is first time Java evaluates any object internally and more over that is totally implicit. Once a programmer is used to of this feature he won't have any trouble but first time it is little confusing even though the theory is known to one



Friday, November 21, 2008


BASEL II is a regulatory framework introduced as BASEL I has been found not-enough to enforce risk management on financial institutions.

It has three pillers:

Economic Capital
Regulatory Capital
Market information disclosure

It targets to mainly manages the bellow three kinds of risks:

Credit Risk
Market Risk
Operational Risk



Monday, November 10, 2008

Hibernate: Issue with Char data type

When doing any query, using Criteria object specially, the Char data type doesn't work in the where clause. The query generated by the Hibernate works perfectly fine on the Oracle console and returns rows but Hibernate returns no rows. The reason might be the Char data type fills the remaining capacity with empty space and Oracle is intelligent enough to ignore those extra spaces while doing query match. But Hibernate is not that smart enough. So it doesn't get the exact match even though visually both the values look same.

The workaround is not to keep char(xx) type for the columns that might be used in the query's where clause. This is economic approach as well as it saves storage space. But if the data base can't be touched then the workaround is, create a view on top of the table and in the view, trim the char(xx) column to get rid of all trailing spaces. Or another work around could be pad the trailing spaces while doing the query but I personally don't like this approach.