I think you should use Double , since it can even contain a null value. So, in the future, if you decide to make the DB column null, then you are safe. You just need to remove @NotNull'. You can not use the primitive @NotNull'. You can not use the primitive double` in this condition.
In any case, hibernate is a relational mapping of objects, I will always stick to using objects in my beans entity. This is a moot point.
There is even a logical problem with primitives, for example, you do not know or do not matter for priceAfterTax . If you use a primitive, the default value will always be 0.0 . That says no tax! . But when I use Double , it is null by default, which means I donโt know what tax is.
source share