[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-6260) Bug with @Min and @Max constraints in TypeSafeActivator for PostgreSQL

Hardy Ferentschik (JIRA) noreply at atlassian.com
Thu May 26 04:58:25 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42411#action_42411 ] 

Hardy Ferentschik commented on HHH-6260:
----------------------------------------

Try setting the property _javax.persistence.validation.mode_ to _callback_. If _auto_ or _ddl_ is used the database constraints are created, otherwise not.
Obviously there is also a dialect problem.

> Bug with @Min and @Max constraints in TypeSafeActivator for PostgreSQL
> ----------------------------------------------------------------------
>
>                 Key: HHH-6260
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6260
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.6.4, 4.0.0.Alpha3
>            Reporter: Roman Boroday
>
> Not sure why validation annotation is enforced against database schema at all, but the current code like 
> String checkConstraint = col.getName() + ">=" + min;
> breaks the whole database generation in PostgreSQL if any of the @Min, @Max or @Range validation are used at the moment.
> When these annotations are applied to a property, for example:
> @Min(value = 0)    
> private int testValue;
> and PostgreSQL dialect is used for the schema generation, the next sample SQL code is created:
> CREATE TABLE "TestEntity" (
>    "testValue" int4 not null check(testValue >= 0)
> )
> Which fails with an error that "testvalue" column is not found.
> The problem is that the check constraint doesn't have quotes around the corresponding column name.
> Code like 
> CREATE TABLE "TableA" (
>    "testValue" int4 not null check("testValue" >= 0)
> )
> would work just fine.

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