0

我尝试使用带有接缝的休眠过滤器。但是它抛出了异常

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 配置吗?

4

1 回答 1

0

当我删除@JoinTable 时,不会引发异常。

于 2012-05-25T18:16:26.650 回答