• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem creating a foreignkey relation in compositekeys

 
aruna sydu
Ranch Hand
Posts: 98
MyEclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 2 tables,


*I included one-to-many in Messages to create a reference from network_id column in the Messages table to the primary key column of the Operator table
*But it is not generating any reference to the operator table in the database.
*If insert="false",update="false" is removed from many-to-one.It is creating the constraint but with a new extra column fkoperatormaster added to Messages table which is not needed.

Please suggest me a way to solve this problem..
 
Angel Taveras
Ranch Hand
Posts: 84
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Aruna, i don't quite follow please explain your problem again and please. I just understood that you wanna use an entity as a part of a primary key it's that correct?
 
aruna sydu
Ranch Hand
Posts: 98
MyEclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Angel ,
Thanks for the reply

What I looking for is ....
*One of the key(referred as key-property in the composite-id)in the
compositekey of table 'A' should refer or point to the primary key of table 'B'.

Please help me how to represent this in a .hbm.xml
 
Angel Taveras
Ranch Hand
Posts: 84
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok this it's how you could do it


[ December 17, 2008: Message edited by: Angel Taveras ]
 
aruna sydu
Ranch Hand
Posts: 98
MyEclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Angel ,

The solution you provided is working..
Thanks a ton
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic