Just encountered a bug, where the issue was that i had:
@Column(name = "ACTIVE")
@NotNull
private boolean active;
In my code I had forgot to set the value but it still "worked" as the default of boolean is false. I have now changed it to Boolean
so that it fails the validation if it is not actively set.
Why am I allowed to have @NotNull
constraints to things that can obviously not be null
? Is it refactoring reasons, so if i change to Boolean as i have done now, i still keep the intended constraint?
Are there any good ideas catch these issues (except more tests for just this purpose)? Or should i keep away from using primitives?