java - Ternary association with a composite primary key (JPA & Hibernate ) -


i'm trying make ternary association composite primary key of 3 keys reference 3 tables : report, scanner , risk , have tried implemente using code below, have composite key 2 keys : riskid , reportid :

report.java

@entity @table(name="report") public class report {     @id     @notnull     @generatedvalue       private int reportid;      @column     private string reportname;      @onetomany     @mapkeyjoincolumn     map<risk, scanner> risks = new hashmap<risk, scanner>(); } 

scanner.java :

@entity @table(name="scanner") public class scanner{     @id     @notnull     @generatedvalue       private int scannerid;      @column     private string scannername;  } 

risk.java :

@entity @table(name="risk") public class risk {     @id     @notnull     @generatedvalue     private int riskid;      @column     private string issuename; } 

so how implemente composite primary key 3 keys ?


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -