jpa - Hashmap with 2 Foreign Keys -


How to create a hampp with reference to 2 foreign keys? Something like that, Table 3 has a hashp, there is an ID from Table 2 for each Table 1 ID.

  @Entity Public Category Table 1 Implementation Serializable {Private Static Last Long Serialvarsion UID = 1L; @ Id @ Generated Values ​​(strategy = generation type.eeto) Private long id; ... @Entity Public Class Table 2 applies Serializable {Private Static Finals Long Serial WarsenUID = 1L; @ Id @ Generated Values ​​(strategy = generation type.eeto) Private long id; ...  

I was trying something like this:

  @Entity Public class table 3 implemented SerialJobile {Private stationary last long serial VERSIONUID = 1L; @ ID @ Generated Values ​​(strategy = generation type AOTO) protected Long ID; @ElementCollection @MapKeyJoinColumn (name = "Table 1", referenced column name = "id") @MapKeyJoinColumn (name = "Table 2", referenced column name = "id") Private map & lt; Table 1, Table 2 & gt; Hashmap_relation = New LinkedHash & lt; Table 1, Table 2 & gt; (); ...  


Comments