-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Problem with Hibernate Filters.
PostPosted: Thu Nov 09, 2006 7:31 am 
Newbie

Joined: Mon Nov 06, 2006 4:16 am
Posts: 3
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);
   }


Last edited by ragerino on Wed Nov 15, 2006 8:52 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: just wanted to put it again on the first page of the forums
PostPosted: Fri Nov 10, 2006 5:35 am 
Newbie

Joined: Mon Nov 06, 2006 4:16 am
Posts: 3
cause maybe someone who is able to answer my question would see it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.