2
我有一個實體,我想成爲一個Enum字段。JPA @Enumerated Error
@Column(name = "TEMPRATURE_ZONE")
@Enumerated(STRING)
private TemperatureRegime tempratureZone;
枚舉定義如下:
public enum TemperatureRegime {
AMBIENT,
CHILL
}
在我的表中該字段的數據始終是「環境」或「CHILL」然而,當我做在桌子上的findAll查詢我得到以下例外:
Exception [EclipseLink-116] (Eclipse Persistence Services - 2.1.0.v20100614-r7608): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: No conversion value provided for the value [Chill] in field [LOCATION_GROUP.TEMPRATURE_ZONE].
Mapping: org.eclipse.persistence.mappings.DirectToFieldMapping[tempratureZone-->LOCATION_GROUP.TEMPRATURE_ZONE]
Descriptor: RelationalDescriptor(com.company.location.LocationGroup --> [DatabaseTable(LOCATION_GROUP)])
我看不出什麼問題,有什麼想法?
乾杯,
詹姆斯
命名的選擇:'TemperatureRegime'(我指着「政權」 )可能不是你想要的。正確地採取'溫度區'或'溫度區域'。當然,這並不能回答你的問題,但是讓你的代碼更清楚你的枚舉是什麼,溫和的政權恰恰不是你的意思...... – Roland 2017-11-18 16:09:30