-->
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: création des index sur les relations many-to-many
PostPosted: Tue Aug 29, 2006 1:51 pm 
Newbie

Joined: Sat Jan 22, 2005 9:39 am
Posts: 10
Bonjour,

Voilà une relation n..n toute bête :

Code:
<class name="A">
<id name="id" type="int" column="ID"/>
<bag table="AB" lazy="true" inverse="true" name="ListB">
<key column="A_ID"/>
<many-to-many foreign-key="FK_B_ID" column="B_ID" class="B"/>
</bag>
</class>

<class name="B">
<id name="id" type="int" column="ID"/>
<bag table="AB" lazy="true" inverse="true" name="ListA">
<key column="B_ID"/>
<many-to-many foreign-key="FK_A_ID" column="A_ID" class="A"/>
</bag>
</class>


Et le script SQL généré :
Code:
create table AB (
        B_ID number(10,0) not null,
        A_ID number(10,0) not null
);

alter table AB
  add constraint FK_B_ID
  foreign key (B_ID)
  references B;

alter table AB
  add constraint FK_A_ID
  foreign key (A_ID)
  references A;



Alors mes questions :

- Pour moi, il manque une clé primaire sur la table AB.
La clé primaire serait composé de la colonne A_ID et B_ID.

- Il manque deux index. Un sur la colonne A_ID et un autre
sur la colonne B_ID.

Je pense que cela vient de mon mapping qui est incomplet.

Vous pouvez me renseigner ? merci


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.