Hibernate version: 3.1.2
I'm using Hibernate trough Spring and i want to enable 2 different Filters at the same time. But only first filter seems to work properly.
The HBM-Files are generated via an Ant-Task.
Here's a Code snippet of my Bean.
Code:
/**
* @hibernate.class
* table="TmAllowanceCalcDefinition"
* @hibernate.cache
* usage="read-write"
* @hibernate.filter
* name="tm_fromDate2Infinite"
* condition="validto > :filterFromDate"
*/
public class TmAllowanceCalcDefinition extends TmDefinitionBase {
.........
/**
* @hibernate.bag
* inverse="true"
* lazy="true"
* cascade="all-delete-orphan"
* @hibernate.key column="DEFINITION_UID"
* @hibernate.one-to-many
* class="at.workflow.webdesk.tm.model.TmAllowanceFactor"
* @hibernate.filter
* name="tm_fromDate2Infinite"
* condition="validto > :filterFromDate"
* @hibernate.filter
* name="tm_inlandOrAbroad"
* condition="foreignCountry = false"
*/
public Collection getAllowanceFactorsInland() {
return allowanceFactorsInland;
}
public void setAllowanceFactorsInland(Collection allowanceFactors) {
this.allowanceFactorsInland = allowanceFactors;
}
/**
* @hibernate.bag
* inverse="true"
* lazy="true"
* cascade="all-delete-orphan"
* @hibernate.key column="DEFINITION_UID"
* @hibernate.one-to-many
* class="at.workflow.webdesk.tm.model.TmAllowanceFactor"
* @hibernate.filter
* name="tm_fromDate2Infinite"
* condition="validto > :filterFromDate"
* @hibernate.filter
* name="tm_inlandOrAbroad"
* condition="foreignCountry = true"
*/
public Collection getAllowanceFactorsAbroad() {
return allowanceFactorsAbroad;
}
/**
* @param allowanceFactorsAbroad The allowanceFactorsAbroad to set.
*/
public void setAllowanceFactorsAbroad(Collection allowanceFactorsAbroad) {
this.allowanceFactorsAbroad = allowanceFactorsAbroad;
}
.........
}
and here's the callin Service-Function
Code:
public TmAllowanceCalcDefCtx getAllowanceCalcDefCtxF(String uid, Date fromDate) {
getHibernateTemplate().clear();
getHibernateTemplate().enableFilter("tm_fromDate2Infinite").setParameter(
"filterFromDate", fromDate);
getHibernateTemplate().enableFilter("tm_inlandOrAbroad");
return (TmAllowanceCalcDefCtx) getHibernateTemplate().get(TmAllowanceCalcDefCtx.class, uid);
}