[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6260?page=c...
]
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira