那麼當我使用枚舉類型並插入到數據庫中時,所有類型值都從0開始不是1.任何簡單的修復+1都不是很好的解決方案。休眠枚舉插入從0開始應該從1開始
的枚舉類
public enum ServiceRequestType {
REGISTERED(1), REJECTED(2), DONE(3);
int value;
ServiceRequestType(int value) {
this.value = value;
}
}
另外休眠映射。
<property name="type" column="service_request_status_type_fk">
<type name="org.hibernate.type.EnumType">
<param name="enumClass">ee.ttu.support.model.domain.service.ServiceRequestType</param>
</type>
</property>
你確定你可以使用=在ENUM中? –
這個問題似乎是關於java,這是無效的語法,而不是c#。 –
你完全正確,這是C#語法。這是在我喝咖啡之前......¬_ – Shagglez