-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: many-to-may indexed collection SchemaExport
PostPosted: Fri Apr 28, 2006 10:21 am 
Newbie

Joined: Thu Jan 27, 2005 3:43 pm
Posts: 2
I have a many to many indexed relation described by the mapping below. The SchemaExport is assuming that the primary key for the link table is one of the primary key plus the position field. I see how that works for a one-to-many relationship but is not good for a many-to-many.

Has anyone encountered this problem? Is there a work around?

Hibernate version:
3.1.3
Mapping documents:
<hibernate-mapping>
<class name="cma.model.Content" table="cma_content">
<id name="contentPk" column="content_pk" unsaved-value="null">
<!-- The generator-class attribute of @hibernate.id is deprecated, use the @hibernate.generator tag instead -->
<generator class="increment"></generator>
</id>
<array name="children" table="cma_parent2children">
<key column="children_pk"></key>
<list-index column="position"></list-index>
<many-to-many class="cma.model.Content" column="parent_pk"></many-to-many>
</array>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():

Name and version of the database you are using:
MySql 4.1
The generated SQL (show_sql=true):

create table cma_parent2children (children_pk bigint not null, parent_pk bigint not null, position integer not null, primary key (children_pk, position)) type=InnoDB;


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.