I want to validate attribute abc using hibernate validator to check if its null or not.
class A {
@NotNull
private B meta;
}
class B {
@NotNull(message = "missing field")
private int abc;
}
When I try to insert data of my pojo class A without having abc field in it, it still accepts it without validating it. How can I get "missing field" error since I'm not passing abc attribute at all?
If I don't pass abc attribute at all, I want error: "missing field", how can this be done?
I found my own answer. Use Integer object and things starts working & also have @Valid tag in class A.