Sunday, 15 April 2012

jpa - Hashmap with 2 Foreign Keys -



jpa - Hashmap with 2 Foreign Keys -

how create hashmap 2 foreign keys reference? like, table 3 have hashmap each table1 id have id table2.

@entity public class table1 implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy = generationtype.auto) private long id; ... @entity public class table2 implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy = generationtype.auto) private long id; ...

i trying this:

@entity public class table3 implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy = generationtype.auto) protected long id; @elementcollection @mapkeyjoincolumn(name = "table1", referencedcolumnname = "id") @mapkeyjoincolumn(name = "table2", referencedcolumnname = "id") private map<table1, table2> hashmap_relation = new linkedhashmap<table1, table2>(); ...

jpa hashmap foreign-keys mapkeyjoincolumn

No comments:

Post a Comment