我尝试使用带接缝的休眠过滤器。但它抛出异常
17:09:37,154 ERROR [STDERR] org.hibernate.HibernateException: No such filter configured [contributorTypeFilter]
at org.hibernate.impl.SessionFactoryImpl.getFilterDefinition(SessionFactoryImpl.java:965)
at org.hibernate.impl.SessionImpl.enableFilter(SessionImpl.java:1032)
at org.jboss.seam.persistence.HibernateSessionProxy.enableFilter(HibernateSessionProxy.java:133)
实体
@OneToMany(cascade = CascadeType.ALL, mappedBy = "wfEntity")
@OrderBy(value="orderNum")
@JoinTable
@FilterJoinTable(name = "ccTypeFilter", condition = "'CC' == WF_TYPE")
private List<WFContEO> wfCCRoles;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "wfEntity")
@OrderBy(value="orderNum")
@JoinTable
@FilterJoinTable(name = "contTypeFilter", condition = "'CONT' == WF_TYPE")
private List<WFContEO> wfConts;
DAOImpl
public EntityEO findById(Long id) {
getSession().enableFilter("contTypeFilter");
getSession().enableFilter("ccTypeFilter");
return (EntityEO) getSession().
createCriteria(EntityEO.class). createCriteria("wf").add(Restrictions.idEq(wfId)).uniqueResult();
}
启用过滤器时会抛出错误。 是否有任何关于如何使用FilterJoinTable的文档? 是否需要任何XML配置?
答案 0 :(得分:0)
当我删除@JoinTable时,不会抛出异常。