-->
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.  [ 5 posts ] 
Author Message
 Post subject: Hibernate Filters
PostPosted: Wed Sep 27, 2006 7:02 am 
Beginner
Beginner

Joined: Fri Apr 28, 2006 3:04 am
Posts: 22
Location: Amsterdam
First of i want to say that the hibernate filters in generall work perfect and i think they are really usefull! So keep up the good work hibernate team ;)


There is one question i have about this @Filter:

I get this error:

"@Filter not allowed on subclasses (ignored): com.nefli.camelot.data.domain.Region"

this is my code;

Region.java (region is the domain class POJO)

Code:
@Entity
@FilterDef(name="disabledFilter") @Filter(name="disabledFilter", condition="disabled = 0")
public class Region extends Asset
{ ... not important


Asset.java (asset is a POJO with the common asset info)

Code:
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class Asset extends AbstractRecordImpl
{ ... not important


AbstractRecordImpl.java (the abstract record with stuff like id, hashcode, equals etc.)

Code:
@MappedSuperclass
public abstract class AbstractRecordImpl implements Record, Serializable
{ .. not important



So why o why can't i create a filter on a subclass?

_________________
Greetz, Marcel - http://java-aap.blogspot.com


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 28, 2006 2:56 am 
Beginner
Beginner

Joined: Fri Apr 28, 2006 3:04 am
Posts: 22
Location: Amsterdam
Anyone? Its a relatively simple question?

_________________
Greetz, Marcel - http://java-aap.blogspot.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 02, 2006 2:56 am 
Beginner
Beginner

Joined: Fri Apr 28, 2006 3:04 am
Posts: 22
Location: Amsterdam
Probebly not so simple :\

_________________
Greetz, Marcel - http://java-aap.blogspot.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 02, 2006 3:11 am 
Beginner
Beginner

Joined: Sun Jan 22, 2006 6:56 am
Posts: 29
I'm just guessing but...
You're using iheritance by joining. This means the hierarchy will be fetched in a single query which joins all the hierarchy tables. The filter stuff is added in the where clause of this query, verbatim. So it will apply to everything retunred by the query. There's no difference if you put it in the base class then.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 02, 2006 4:38 am 
Beginner
Beginner

Joined: Fri Apr 28, 2006 3:04 am
Posts: 22
Location: Amsterdam
Yes, but, I have the filter at the subclass because the subclass is the only entity with knowledge about his properties.
ie. Region has a property Country... This is defined in the region class, so i want my filter to say something like 'where region.country = :country'..

And there might be other subclasses on the same baseclass, like a Resort, but the filter i want to add on a Resort is different then the filter i'd like to add on the Region, but they have to same baseclass.

But when i add the filter to a subclass i get this error:

"@Filter not allowed on subclasses (ignored): com.nefli.camelot.data.domain.Region"

_________________
Greetz, Marcel - http://java-aap.blogspot.com


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