[JPA_SPEC-34] Add support for JSR303 (Bean validation) annotations. Created: 18/Jul/12  Updated: 15/Apr/14

Status: Open
Project: jpa-spec
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: velobr Assignee: ldemichiel
Resolution: Unresolved Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: RFE

 Description   

Right now, JPA spec neglect Bean Validation annotations.

The way it is now we end with duplicated information:

    @Column(nullable = false, length = 200)
    @NotNull
    @Size(min = 4, max = 200)
    private String name;

Would be nice just do:

    @Column
    @NotNull
    @Size(min = 4, max = 200)
    private String name;

and end with same result.



 Comments   
Comment by ldemichiel [ 10/Dec/12 ]

Actually, result is not the same, because Bean Validation will trap the constraint validation before it goes to the database. I think what you may be asking for is integration of Bean Validation constraints into the schema generation facility. There has not been strong support for this, but it is something that we could consider in a future release.

Comment by c.beikov [ 15/Apr/14 ]

I think that this is also related to JPA_SPEC-23
If a "PhysicalCustomizer" as mentioned in the comments could alter the column definition we could even translate annotations to domain constraints by ourselves. I guess what we really need here is an abstraction that enables us to enrich the meta- and physical model in general.

Generated at Wed Apr 01 18:42:34 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.