I currently have a question about the database of my work.
They use a String based on 0 and 1 to indicate whether it is active or not. But for my logic I would like to use true or false.
Why? Because have redundant code. For example:
if(foo.getStateClient().equals("1"))
//Do things...
Imagine that with 6 or 7 fields more.
Cant modify the database. And I dont know if use Strings like the before example, or do anything to cast the String a Boolean.
And, always the state is 0 or 1
I appreciate any advice to be more optimal
Edit 1 I am not asking how doing, i am asking the Best practice to do that.
I am using Spring with Hibernate that for people ask me what ORM i am using.
"1".equals(foo.getStateClient())Booleantype for such fields.. Framework will transform it under the hood. Of course it depends on specific framework and data types