我想创建具有相同键的多个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 ...