@Entity
public class Foo {
[...]
@Valid
@Embedded
private Poo poo;
}
@Embeddable
public class Poo {
@NotNull
private Double value;
@NotNull
private Double value2;
[...]
}
I need to save the class Poo as null in the database and consequently any attribute that already exists in the table is converted to null. It's possible?
The only way I could do it was to remove @NotNull from the attributes and set each attribute itself to null.
Just had the same problem and I solved it by adding an Annotation like @NotNull just underneath the annotation @Valid
@Entity
public class Foo {
[...]
@Valid
@Embedded
@NotNull
private Poo poo;
}
@Embeddable
public class Poo {
@NotNull
private Double value;
@NotNull
private Double value2;
[...]
}