[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6260) Bug with @Min and @Max constraints in TypeSafeActivator for PostgreSQL
Roman Boroday (JIRA)
noreply at atlassian.com
Thu May 26 04:28:29 EDT 2011
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: 4.0.0.Alpha3, 3.6.4
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