标签:style blog http io ar color sp on div
http://soft-development.iteye.com/blog/1225274
——————————————————————————————————————————————————————————————————————————————
1.JPA本身是不支持boolean。可以用Hibernater自带的标签.修改如下. @Column(name = "manager_log") @org.hibernate.annotations.Type(type="yes_no") private boolean manageLog = false; // 能否管理系统日志 2.当然你也可以不用Hibernater的标签,但要改写setter,getter方法 给你一个例子: @Entity public class User { @Id private Integer id; @Basic private Character enabled; public Boolean getEnabled() { if (enabled == null) return null; return enabled == ‘Y‘ ? Boolean.TRUE : Boolean.FALSE; } public void setEnabled(Boolean enabled) { if (enabled == null) { this.enabled = null; } else { this.enabled = enabled == true ? ‘Y‘ : ‘N‘; } } }
标签:style blog http io ar color sp on div
原文地址:http://www.cnblogs.com/cuizhf/p/4110486.html