[hibernate-issues] [Hibernate-JIRA] Commented: (HV-516) Hibernate Validator doesn't work well with hibernate persistence when generating DDL

Hardy Ferentschik (JIRA) noreply at atlassian.com
Fri Dec 9 12:06:19 EST 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HV-516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44555#comment-44555 ] 

Hardy Ferentschik commented on HV-516:
--------------------------------------

Also tested against Oracle. The constraint gets applied as well. There is an issue when trying to insert into the generated column, but this has nothing to do with the constraint not getting applied. See HHH-6887

> Hibernate Validator doesn't work well with hibernate persistence when generating DDL
> ------------------------------------------------------------------------------------
>
>                 Key: HV-516
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-516
>             Project: Hibernate Validator
>          Issue Type: Bug
>          Components: engine
>    Affects Versions: 4.2.0.Final
>         Environment: java6, hibernate 3.6.7
>            Reporter: David J. M. Karlsen
>            Assignee: Hardy Ferentschik
>            Priority: Critical
>             Fix For: 4.3.0.next
>
>
> According to http://docs.jboss.org/hibernate/annotations/3.5/reference/en/html_single/#d0e4044 validation annotations should influence the DDL generation. This is not the case.
> If I have the following field declaration:
> {noformat}
>    @Length( max=10 )
>     private String test;
> {noformat}
> it will generate the standard 255:
> {noformat}
>  test varchar2(255 char),
> {noformat}
> It appears to be an *ancient* bug - dating back from 2007:
> From https://forum.hibernate.org/viewtopic.php?t=975612
> I do have 
> {noformat}
> <property name="javax.persistence.validation.mode" value="callback, ddl" />
> {noformat}
> in my persistence.xml configuration.
> It's needless to say how irritating it is to define the constraints several times for each attribute.
> Any chance of getting this fixed (or correct the faulty documentation)?
> It's not a blocker since it's possible to define the constraints twice - once for hibernate persistence - and once for validation - but it is very very inefficient - and can lead to inconsistencies.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list