[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6703) id element has 'column' attribute, then the pk column is nullable in ddl created by schema export

Strong Liu (JIRA) noreply at atlassian.com
Fri Sep 30 12:14:20 EDT 2011


id element has 'column' attribute, then the pk column is nullable in  ddl created by schema export 
---------------------------------------------------------------------------------------------------

                 Key: HHH-6703
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6703
             Project: Hibernate Core
          Issue Type: Bug
          Components: metamodel
    Affects Versions: 4.0.0.CR4
            Reporter: Strong Liu


this can be reproduced by org.hibernate.test.discriminator.SimpleInheritanceTest#testDiscriminatorSubclass
in SimpleInheritance.hbm.xml:
{code:xml}
		<id name="id" 
			column="person_id"
			unsaved-value="0">
			<generator class="assigned"/>
		</id>
{code}
and sql generated is
{quote}
    create table "Person" (
        "person_id" bigint,
        "TYPE" char(255),
        "name" varchar(255) not null,
        "sex" char(255) not null,
        "title" varchar(255),
        "salary" decimal(19,2),
        "comments" varchar(255),
        primary key ("person_id")
    )
{quote}

if we remove that _column="person_id"_, then it changes to 
{quote}
    create table "Person" (
        "id" bigint not null,
        "TYPE" char(255),
        "name" varchar(255) not null,
        "sex" char(255) not null,
        "title" varchar(255),
        "salary" decimal(19,2),
        "comments" varchar(255),
        primary key ("id")
    )
{quote}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list