• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Hibernate Many-To-Many Mapping

 
Jason Ferguson
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll start out by saying that I'm not good with Many-To-Many mappings.

I have two tables, T_TECHNICIAN and T_PROJECT. These two tables are connected by the T_PROJECT_LINK table.

Here are abridged versions of my Technician and Project classes:





Unfortunately, when I view a Project in my debugger, the Technicians set is null.

Have I made a very basic error in my mappings? I've checked the Link table to confirm that what I'm looking for is there.
 
Shailesh Kini
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi J.,

Can you please confirm that T_TECHNICIAN table has PERSONID and T_PROJECT has PROJECTID as the primary keys and T_PROJECT_LINK table has PERSONID and PROJECTID columns? If the column names are different, can you please use referencedColumnName in @JoinColumn() annotation and try if it works?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic