在我的数据库中,我有这样的列
"ISDEFAULTPAYMENTFORCURRENCY" CHAR(1 BYTE) NOT NULL ENABLE,
CHECK (ISDEFAULTPAYMENTFORCURRENCY IN ('N','Y')) ENABLE,
在我的bean中,我有
private Boolean isDefaultPaymentForCurrency;
我的问题是,如何在 hibernate hbm 文件中映射此 isDefaultPaymentForCurrency
?
<property name="isDefaultPaymentForCurrency" type="???" column="ISDEFAULTPAYMENTFORCURRENCY" not-null="true"/>
最佳答案
使用
<property name="isDefaultPaymentForCurrency" type="yes_no" column="ISDEFAULTPAYMENTFORCURRENCY" not-null="true"/>
要使用 hql,您可以在 hibernate.cfg
<property name="hibernate.query.substitutions">true 'Y', false 'N'</property>
关于java - 如何在 hibernate hbm 文件中映射 boolean 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18902205/