[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
Tue Sep 6 06:47:02 EDT 2011


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

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

FYI, I added a test against H2 and it works - https://github.com/hferentschik/hibernate-core/commits/HV-516
Have turned on debug trace and checked the output of the DDL task?

> 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
>
> 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