【发布时间】:2018-11-16 15:46:25
【问题描述】:
我不能使用 joinformula 选择最后一个。地图工作正常,但使用连接公式显示以下错误:
来自 Instrumento 的外键 InstrumentoData 的列数错误。应该是 2
@MapKeyTemporal(TemporalType.DATE)
@MapKey(name = "dataMovimento")
@OneToMany(mappedBy = "instrumento")
@LazyCollection(LazyCollectionOption.EXTRA)
private final Map<Date, InstrumentoData> instrumentoData = new HashMap<>();
@ManyToOne(fetch = FetchType.LAZY)
@JoinFormula(value = "(SELECT i.ID_INSTRUMENTO FROM InstrumentoData i WHERE i.ID_INSTRUMENTO = id ORDER BY i.data_Movimento DESC LIMIT 1)")
private InstrumentoData ultimoInstrumentoData;
有人帮帮我吗?
【问题讨论】: