I have a entity class User. I want to add some more properties but to keep them nullable. I want to know the annotation used for this in JPA. I am using JPA in Google App Engine.
Thanks
I have a entity class User. I want to add some more properties but to keep them nullable. I want to know the annotation used for this in JPA. I am using JPA in Google App Engine.
Thanks
Properties are nullable by default in JPA, except primitive types. You can control nullability using the nullable
property of the @Column annotation, like so:
//not nullable
@Column(nullable = false)
private String prop1;
//nullable
@Column(nullable = true)
private String prop2;
//default = nullable
@Column
private String prop3;