Is there a difference in declaring the enabled variable as Boolean or boolean? Which is preferable from a memory footprint perspective.
@Entity
class User {
I would usually suggest using the primitive types, just to get rid of null checks all over the place. But it really depends on what you want to say. Your Boolean now can hold 3 values:
And null can make a total new semantic when dealing with entities. I usually use it as "No data available". Your "enabled" might be a bad example for this kind of field. But lets say you have a number which holds the age of a person.
private Integer age;
When you use null, you can treat this as: "Unknown". You could also use an int and define a special value (-1) for this case, but null is the more natural solution.
So, to sum it up. Use primitives if there is always a meaningful value (required fields?) and wrapper classes for optional values.