[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4448) SchemaExport - Provide a constant naming generation for constraints

Marcelo Felix (JIRA) noreply at atlassian.com
Thu Sep 17 18:04:49 EDT 2009


SchemaExport - Provide a constant naming generation for constraints
-------------------------------------------------------------------

                 Key: HHH-4448
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4448
             Project: Hibernate Core
          Issue Type: Improvement
            Reporter: Marcelo Felix


We have a frequent database maintenance problem - Hibernate doesn't gererate a constant name for Unique and Primary keys. The name of a given key becomes different everytime it's recreated.  Hence, if the schema generation and database creation is part os the build (as in our case), this problem makes the build irreproducible (different builds could generate differente database schemas). 
 
At the moment, when we need to modify a unique key, for example, we have to search its name in a Oracle system table. To worsen, in production environments we don't have such access.
 
I noticed that hbm2ddl generates Foreign Key constraints based on hashcodes. 
 
Is it possible to improve Hibernate, to do the same naming generation for Unique and Primary Keys? 
 
The final result would be like this:

create table USER (
     ID number(19,0) not null,
     COLUMN1 varchar2(255 char),
     COLUMN2 varchar2(255 char),
     constraint PK_27E3CBF73AEE0F primary key (ID),
     constraint UK_27E3CB143B677E unique (COLUMN1, COLUMN2)
);
 
Perhaps would be necessary to activate this feature according to the dialect.
 
I also noticed related requests, like HB-1245 and HHH-3296, but I think that my request is a lot more easier to accomplish - we just need a constant name, whatever it would be.
 
If it seems reasonable I could develop and send  a patch .

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