I have a table with four columns, say
P_Key(int), Ref_Key(int), Key(String), Value(Integer).
I want to avoid multiple create statements by persisting a map along with Ref_key into this database. Map contains keys and corresponding value.It will create multiple row for that Ref_key using entries from the map.I am using hibernate.
Suppose, I want to persist following map :
"Me" -> 0
"You" -> 10
"They" -> 12
and Ref_Key is 123.
Then it should create 3 rows into table.
P_Key Ref_Key Key Value
1 123 "Me" 0
2 123 "You" 10
3 123 "They" 12
Assuming that key starts with 1 and is auto-incremented.
What is the approach that I should follow?