[hibernate-issues] [Hibernate-JIRA] Commented: (HB-1548) CLONE -Ability to specify names of constraints (PK, Check, Unique)

Diego Pires Plentz (JIRA) noreply at atlassian.com
Sun Oct 14 22:19:39 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HB-1548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_28422 ] 

Diego Pires Plentz commented on HB-1548:
----------------------------------------

Dup.

> CLONE -Ability to specify names of constraints (PK, Check, Unique)
> ------------------------------------------------------------------
>
>                 Key: HB-1548
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HB-1548
>             Project: Hibernate2
>          Issue Type: Improvement
>          Components: core, toolset
>    Affects Versions: 2.1.7
>            Reporter: Steve Ebersole
>            Assignee: Steve Ebersole
>            Priority: Minor
>
> Under Oracle, and possibly other DBs, if you dont specify a constraint name for primary keys, check and unique constraints Oracle creates a system default name which is no help to anyone hitting the DB if the violate the constraint.
> It would be nice to be able to generate SQL along the lines of:
> CREATE TABLE foo
> (
>     id number(19,0) not null,
>     a integer not null,
>     b integer not null,
>     CONSTRAINT PK_foo PRIMARY KEY (ID),
>     CONSTRAINT CK_A_NONZERO CHECK ( a > 0 ),
>     CONSTRAINT CK_B_NONZERO CHECK ( b > 0 )
> );
> where the PK name for the <id> element can be set by attribute (similar to how the foreign-key name can be set).
> For check constraints, maybe an additional attribute check-name=""
> could be added
> Ive implemented the PK name for <id> elements, but now notice there are additional PKs created by Hibernate. The check constraint seems a little more involved, but I was thinking about derriving a new class, CheckConstraint from Constraint, and having the value from the existing check attribute stored, and also a constraintName.
> The individual dialects could then have a new getCreateConstraintSQL method to switch this out for the different DBs.
> Nick

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