未找到SQL插入列 - 地图

时间:2016-01-10 13:57:24

标签: java hashmap sql-insert h2db

我想创建具有相同键的多个HashMaps。我使用@SQLInsert修复了这个问题。 但现在我得到Column not found错误,也许我注释错了?

@ElementCollection
@CollectionTable(name = "BACKUP_INVENTORY", joinColumns =  @JoinColumn(name = "BACKUP_ID"))
@MapKeyJoinColumn(name = "INVENTORY_ID", referencedColumnName = "ID")
@Column(name="AMOUNT")
@SQLInsert(sql="MERGE INTO BACKUP_INVENTORY(BACKUP_ID, INVENTORY_ID,  AMOUT) VALUES (?, ?, ?)")
private Map<InventoryItemIdentifier, Number> backupCount;

错误 -

Caused by: org.h2.jdbc.JdbcSQLException: Feld "INVENTORY_ID" nicht gefunden
Column "INVENTORY_ID" not found; SQL statement:
MERGE INTO BACKUP_INVENTORY(BACKUP_ID, INVENTORY_ID,  AMOUT) VALUES (?, ?, ?)[42122-190]

也许有些人有更好的想法来创建具有相同密钥的多个HashMaps?

示例:

  

HashMap1:key = abc value = 5 ...

     

HashMap2:key = abc value = 2 ...

0 个答案:

没有答案