in reply to Moose - ensuring a getter returns a number

The idea of solving a problem with your database code in your data class feels wrong to me. The fact that your database code is "in many places" is your real problem.

A good solution would be to numify the value before placing it in the object in the first place.

There are some more hackish solutions too: