hibernate配置enum枚举属性
2015-10-27 13:46
337 查看
LimitBy.java
public class AccessDurationPolicy extends Policy {
public static final int UNLIMITED_DURATION = 0;
private int durationInMinutes;
private LimitBy limitBy;
public int getDurationInMinutes() {
return durationInMinutes;
}
public void setDurationInMinutes(int durationInMinutes) {
if (durationInMinutes < 0) {
throw new IllegalArgumentException("时长不能小于0.");
}
this.durationInMinutes = durationInMinutes;
}
public LimitBy getLimitBy() {
return limitBy;
}
public void setLimitBy(LimitBy limitBy) {
this.limitBy = limitBy;
}
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.ndkey.am.access.policy; /** * * @author zxf */ public enum LimitBy { BY_USER, BY_TERMINAL }
public class AccessDurationPolicy extends Policy {
public static final int UNLIMITED_DURATION = 0;
private int durationInMinutes;
private LimitBy limitBy;
public int getDurationInMinutes() {
return durationInMinutes;
}
public void setDurationInMinutes(int durationInMinutes) {
if (durationInMinutes < 0) {
throw new IllegalArgumentException("时长不能小于0.");
}
this.durationInMinutes = durationInMinutes;
}
public LimitBy getLimitBy() {
return limitBy;
}
public void setLimitBy(LimitBy limitBy) {
this.limitBy = limitBy;
}
<property column="limit_by" name="limitBy"> <type name="org.hibernate.type.EnumType"> <param name="enumClass">com.ndkey.am.access.policy.LimitBy</param> <param name="useNamed">true</param> </type> </property>
相关文章推荐
- 编辑距离及编辑距离算法
- 初探oVirt-体验REST-API
- 废物再利用 旧Android手机打造Web服务器
- 如何获取Android RecyclerView滑动的距离
- poj 2229
- iOS---UIImage
- StreamCQL : 实时计算系统 ( CEP ) 中的持续查询语言 CQL
- Tomcat报错java.lang.ClassNotFoundException: 2localhost.org.apache.juli.FileHandler
- 实现最小宽度的几种方法及CSS Expression[转]
- 9.png图片制作详细教程
- im4java+ImageMagick+GraphicsMagick
- Session详解
- angular JS 拦截器总结
- 执行 apt-get -f install 提示错误
- HDU 1242 rescue and 优先级队列的条目
- tslib移植
- oracle基本命令
- mac os x下nginx开机自启动
- Android UI学习——ListView 和Adapter
- 网站的SEO