@Column(name="REF_ID")
private int refId;
When I tested it, and set null value to this attribute, I got the error "Null value was assigned to a property of primitive type setter of MyDomain.myAttribute".
To solve the problem, I just simply changed the int data type to Integer. Then everything works perfectly fine.
A null value cannot be assigned to a primitive type, like int, long, boolean, etc. If the database column that corresponds to the field in your object can be null, then your field should be a wrapper class, like Integer, Long, Boolean, etc.
No comments:
Post a Comment