Skip to content

NH-3128 - Schema generation tool create incorrect foreign keys for combined joined-subclass and one-to-one mapping declarations. #1018

Open
@nhibernate-bot

Description

@nhibernate-bot

Sergey Matyukevich created an issue — 24th April 2012, 6:01:31:

I have a simple mapping declaration:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
					   assembly="NHibernate.Test"
					   namespace=" NHibernate.Test.CustomTest">

	<class name="Child" table="CHILDREN">
	    <id name="Id" column="ID">
            <generator class="increment" />
        </id>
        <joined-subclass name="Parent" table="PARENTS">
          <key column="ID"/>
          <one-to-one name="Info" constrained="true" cascade="all"/>
        </joined-subclass>
    </class>

  <class name="Info" table="INFO">
    <id name="Id" column="ID">
      <generator class="foreign">
        <param name="property">Parent</param>
      </generator>
    </id>
    <one-to-one name="Parent" />
  </class>

</hibernate-mapping>

It seems that everything works correct for such kind of mapping and insertions are made in the right order, but when I user schema generation tool, it generates table PARENTS with only one foreign key from PARENTS.ID to CHILDREN.ID. I also expect foreign key from PARENTS.ID to INFO.ID to be generated (as part of one-to-one declaration)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions