[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4045) Oracle PrimaryKey and Not Null Constraint have no explicit Name

Peter Kamm (JIRA) noreply at atlassian.com
Fri Jul 17 11:04:13 EDT 2009


Oracle PrimaryKey and Not Null Constraint have no explicit Name
---------------------------------------------------------------

                 Key: HHH-4045
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4045
             Project: Hibernate Core
          Issue Type: Improvement
          Components: core
    Affects Versions: 3.3.1
         Environment: Oracle Dialect's
            Reporter: Peter Kamm
         Attachments: mapping.zip

If I have a Class like this:

@Entity
@Table(name = "ADDRESS ")
public class Address {
    @Id
    @Column(name = "ADDRESS_PK", nullable = false, precision = 20)
    private Long Id;

    @Column(name = "STREET" , nullable = false, length = 50)
    private String street;

    @Column(name = "ZIP_CODE" , nullable = false, length = 10)
    private String zipCode;

}

I get a DDL like this:
   create table ADDRESS (
        ADDRESS_PK number(19,0) not null,
        STREET varchar(50) not null,
        ZIP_CODE varchar(10) not null,
        primary key (ADDRESS_PK)
    );


What I would lik to have is this:
   create table ADDRESS (
        ADDRESS_PK number(19,0) constraint NN4FB7B77D240AE17A not null,
        STREET varchar(50) constraint NN4FB7B77DA9D7335B not null,
        ZIP_CODE varchar(10) constraint NN4FB7B77DFF11B2F not null,
        constraint ADDRESSPK primary key (ADDRESS_PK)
    );

So that the Constraints have explicit names. This would be alot more usable for Schema comparing.

I've attached the suggestion code of the Table and PrimaryKey Class, which could be extended,
with some Dialect Methods.

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