Using primitives or wrapper class in Hibernate?
问题 Mapping database with Hibernate. We should use Double with @NotNull constraint Or use the double primitive type instead. What is the best practice? (Using Java 6) @Column(name = "price_after_tax", nullable=false) @NotNull public Double getPriceAfterTax() { return priceAfterTax; } OR @Column(name = "price_after_tax") public double getPriceAfterTax() { return priceAfterTax; } Many thanks! 回答1: I think you should use Double as it can hold even null value. So, in future if by any chance you