Anyway, I have a 'cost' attribute & I have declared it as 'double'.
The fact is that all 'costs' generally comes in 452.50(integer.2decimalplaces). Is it possible to cast the double values to "2 decimal places'? If yes, please give me some hint or a link to some webpage.
Christian, Doubles don't represent decimal values so well as they can be stored differently and cause rounding errors. For example, 3.33333333333333333 doesn't equal 3.33. In practice, people usually use BigDecimal which does let you set the number of decimal places.
They use BigDecimal, or they use either int or long and store the value of 452.50 as 45250. When you do this, you need to make sure it's well-documented what the numbers mean. E.g. does a field value represent dollars, or cents? But then again, you always need to document that sort of information.