I mean that to a developer, it should not make any difference whether @Column(nullable = false) or @NotNull is used, and therefore both should be equivalent in effect. That is, both should (if supported by the underlying DB) set a NOT NULL constraint, and if validation fails (whether at the java validation level or at the DB level) they should raise the same exception (InvalidStateException presumably), which should suppport localised messages in both cases.
And for the same reasons, the @Unique constraints, which I understand why they are in JPA and done purely as DB-layer checks, should also generate the same exception (wrapped by the jsr303 validaiton layer or not) and support localised messages. For consistency's sake.
Most developers will not really want to care whether one validation annotation comes from JPA or JSR303. If presented with annotations from both APIs that sound roughly the same but actually have slightly different semantics and different exception behaviour, it will be confusing. I'm against confusion :)
So there is some level of interaction/integration that I expect from JPA and JSR303, even though I understand JSR303 has a broader scope than JPA. Overlapping functionality with different semantics is confusing. Hell, I think I understand the differences but still I get confused. Maybe it's just me though, I'm certainly not ruling it out ;)
_________________ --
Stéphane Épardaud
|