-->
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.  [ 2 posts ] 
Author Message
 Post subject: attribut partagé
PostPosted: Mon Dec 03, 2007 4:26 am 
Newbie

Joined: Sat Dec 01, 2007 7:33 am
Posts: 8
Bonjour

mon probleme est le suivant j'ai deux table : Tab1, Tab2 lié par une clé étrangère pour mieux voir les choses voilà un exemple simple:

Tab1
------
A1 : PK
B1: Fk relative à Tab2
A2:

Tab2
------
B1:PK
B2: (attribut de type varchar)

mon problème est d'assurer la relation suivante A2 = B2

j'ai déja trouvé une solution :

au niveau de fichier de mapping relatif à Tab1

<property name="A2"" formula="(select T2.B2 from Tab2 T2 where A2=T2.B2)" />

j'aime bien voir si on peut trouver une autre solution pour traiter ce probleme .

merci d'avance pour votre aide.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 09, 2008 7:20 am 
Newbie

Joined: Wed Jan 09, 2008 6:26 am
Posts: 19
Je ne vois guère d'autres solutions de procéder mais... ce que tu fais est une hérésie du point de vue relationnel! Pourquoi dupliquer l'information de B2 dans A2 puisque tu peux très bien accéder à B2 dans Tab1 en faisant: Tab1.Tab2.B2? Hibernate est justement là pour te permettre de "naviguer" dans l'arborescence de tes objets...


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

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.