1.在hbm文件中写
<filter-def name="myFilter"> <filter-param name="param" type="short"/> </filter-def>
2.我这里是想过滤字表中status字段,所以在set中写
<filter name="myFilter" condition=":param=status"/>
3.在应该之处,对当前session设置值
session.enableFilter("myFilter2").setParameter("param", t);
...
http://blog.csdn.net/dengqf/article/details/6603531