Issue Details (XML | Word | Printable)

Key: JPA_SPEC-34
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: ldemichiel
Reporter: velobr
Votes: 2
Watchers: 2

If you were logged in you would be able to see more operations.

Add support for JSR303 (Bean validation) annotations.

Created: 18/Jul/12 02:10 PM   Updated: Tuesday 03:53 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Tags: RFE
Participants: c.beikov, ldemichiel and velobr

 Description  « Hide

Right now, JPA spec neglect Bean Validation annotations.

The way it is now we end with duplicated information:

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

Would be nice just do:

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

and end with same result.

ldemichiel added a comment - 10/Dec/12 10:43 PM

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.

c.beikov added a comment - 15/Apr/14 03:53 PM

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.