Cfg.GenerateSchemaCreationScript many-to-many

Description

I used the following hbm's:

------------Parent--------------------
<hibernate-mapping>
<class name="test.hibernate.Parent" table="Parent">
<id name="id" type="Int64" unsaved-value="null" >
<column name="id"/>
<generator class="native"/>
</id>
<set name="children" table="Parent_Child">
<key column="parent_id"/>
<many-to-many class="test.hibernate.Child" column="child_id" />
</set>
</class>
</hibernate-mapping>

----------------Child-------------------
<hibernate-mapping>
<class name="test.hibernate.Child" table="Child">
<id name="id" type="Int64" unsaved-value="null" >
<column name="id"/>
<generator class="native"/>
</id>
</class>
</hibernate-mapping>

When I call Cfg.GenerateSchemaCreationScript() it returns the following schema script:

create table Parent_Child (parent_id BIGINT not null, child_id BIGINT null)

create table Parent (id BIGINT IDENTITY NOT NULL, primary key (id))

create table Child (id BIGINT IDENTITY NOT NULL, primary key (id))

alter table Parent_Child add constraint FK5AF11D477B66B0D0 foreign key (parent_id) references Parent

alter table Parent_Child add constraint FK5AF11D4762EA171E foreign key (child_id) references Child

Notice that on the Parent_Child table there is no PK and the child_id is NULL when it sould be NOT NULL.

NOTE: I ran the exact same hbm's using java Hibernate and the generated schema includes all the missing attributes.

Environment

Cfg.GenerateSchemaCreationScript is generating incomplete schema for many-to-many collections

Activity

Former user 
June 5, 2005 at 5:51 AM

Fixed in CVS

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created April 27, 2005 at 10:26 AM
Updated June 5, 2005 at 5:51 AM
Resolved June 5, 2005 at 5:51 AM
Who's Looking?