[hibernate-issues] [Hibernate-JIRA] Updated: (HV-25) Generated DDL ignores Validator annotations on component fields and superclass fields

Hardy Ferentschik (JIRA) noreply at atlassian.com
Thu Feb 12 08:16:45 EST 2009


     [ http://opensource.atlassian.com/projects/hibernate/browse/HV-25?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hardy Ferentschik updated HV-25:
--------------------------------

    Component/s:     (was: engine)
                 legacy

Moved issue into legacy component. This issue applies to codebase prior 4.x

> Generated DDL ignores Validator annotations on component fields and superclass fields
> -------------------------------------------------------------------------------------
>
>                 Key: HV-25
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-25
>             Project: Hibernate Validator
>          Issue Type: Bug
>          Components: legacy
>    Affects Versions: 3.0.0.ga
>         Environment: Windows XP, Hibernate 3.2.4.sp1, Hibernate Annotations 3.3.0.ga, Postgres, HSQL
>            Reporter: Ben Anderson
>         Attachments: model.zip, ValidEmbeddable.zip
>
>
> The DDL generated for entities containing components or superclass properties does not reflect any Validator length restrictions or not-null constraints that have been defined on those component or superclass properties i.e. a component with a property containing the @Length(max = 50) and @NotNull annotation is generated as varchar(255) with nulls permitted (at the database level).
> I've posted a more detailed example to the forum at http://forum.hibernate.org/viewtopic.php?t=975612
> Another example can be found at http://www.ibm.com/developerworks/web/library/j-hibval.html - the SQL generated when this schema is exported is:
> create table cc (id integer not null, fname varchar(255), mi varchar(255), lname varchar(255), addr1 varchar(255), addr2 varchar(255), city varchar(255), zipcode varchar(255), state_id varchar(255), cvv2 varchar(6) not null, expiration_date timestamp not null, type_id integer not null, num varchar(30) not null, customer_id integer not null, primary key (id));
> create table customer (id integer not null, dob timestamp, phone varchar(255), fax varchar(255), email varchar(255), fname varchar(255), mi varchar(255), lname varchar(255), addr1 varchar(255), addr2 varchar(255), city varchar(255), zipcode varchar(255), state_id varchar(255), primary key (id));
> The SQL should be:
> create table cc (id integer not null, fname varchar(30) not null, mi varchar(1), lname varchar(30) not null, addr1 varchar(50) not null, addr2 varchar(50), city varchar(50) not null, zipcode varchar(15) not null, state_id varchar(2) not null, cvv2 varchar(6) not null, expiration_date timestamp not null, type_id integer not null, num varchar(30) not null, customer_id integer not null, primary key (id));
> create table customer (id integer not null, dob timestamp, phone varchar(13), fax varchar(13), email varchar(40), fname varchar(30) not null, mi varchar(1), lname varchar(30) not null, addr1 varchar(50) not null, addr2 varchar(50) not null, city varchar(50) not null, zipcode varchar(15) not null, state_id varchar(2) not null, primary key (id));
> I've attached the relevant classes from this example. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list