0
我有這樣的DB場景;許多複雜的休眠映射
基表:
STUDENT (student_id, name)
SPORT (sport_id, name)
SPORT_SUB (sport_sub_id, name)
多對多映射表:
SPORT_CATEGORY (sport_id, sport_sub_id, sport_category_id)
STUDENT_SPORT_CATEGORY (student_id, sport_category_id)
任何人都可以提出一個方法使用Hibernate映射這一情況。我使用Hibernate工具和eclipse生成了POJO和HBM文件,並且它很成功。但是,當我試圖插入一個運動和運動子進入db後異常給出:
Foreign key (FK4979B7EDEB6823:student_sport_category [sport_category_id])) must have same number of columns as the referenced primary key (sport_category [sport_ID,sport_sub_ID])
任何建議將不勝感激。謝謝。 (厭倦了這個問題..)
你可以發佈你的hbm文件和你用來插入Sport and Sport Sub的代碼嗎? – EkcenierK