• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

many-to-one relationship to non-PK field

 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to declare a foreign key relationship between two entities where the type is java.lang.String and the related entity field is not a primary key but is a unique field. If I attempt the same thing, but relating to a primary key field (by leaving off the property-ref attribute which defaults to the id), I have no problem.

I have narrowed down a test case in an attempt to solve this problem but to no avail. The problem is that 'schemaexport' will generate the two tables X and Y but will not create the relationship and I don't understand why (also, why it does the create the relationship when relating to a PK field). I am using the Microsoft type 4 driver for MS SQL Server 2000.

Please find below two source files annotated with XDoclet and corresponding mapping files. Any assistance is most appreciated.







 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic