-->
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.  [ 4 posts ] 
Author Message
 Post subject: Class level filters don't work with subclasses
PostPosted: Sun Jul 10, 2005 1:33 pm 
Newbie

Joined: Sun Nov 07, 2004 7:03 am
Posts: 8
Hi,

I've got two classes: EntityHb and Indexed EntityHb, looking like this:

Code:
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@org.hibernate.annotations.FilterDefs({
    @org.hibernate.annotations.FilterDef(
            name = "indexFilter",
            parameters = {
                @org.hibernate.annotations.ParamDef(name="index", type="integer")
            }
    )
})
public abstract class EntityHb implements Serializable {
   
    protected Integer id;

    ...
}


and

Code:
@Entity
@Table(name="test_indexed_entity")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)   
@Filter(name = "indexFilter", condition=":index > index")
public class IndexedEntityHb extends EntityHb {
   
    protected Integer index;
    ...
}


The problem is the "indexFilter" filter is ignored while executing any query, such as "FROM IndexedEntityHb". The application works fine if the @Filter tag is placed at EntityHb class. However, I need to define this filter in IndexedEntityHb class.
Thanks in advance for every hints.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 10, 2005 1:39 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I'd have to check with Steve, but my guess is that you can't just add a filter on a subclass. Check what is supported by the XML mapping DTD.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 10, 2005 1:57 pm 
Newbie

Joined: Sun Nov 07, 2004 7:03 am
Posts: 8
Thnx for fast response.
You are absolutely right, filters indeed cannot be applied to subclasses. Therefore, how can I apply a filter to IndexedEntityHb in the example above? If it's defined for EntityHb, it tries to filter other EntityHb subclasses, which ends up with mapping exception during queries execution, as other classes don't have the "index" field.


Top
 Profile  
 
 Post subject: I am also runnimg into this problem,
PostPosted: Fri Apr 07, 2006 10:14 am 
Newbie

Joined: Fri Apr 07, 2006 10:09 am
Posts: 2
does someone know the solution?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.