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: @Filter not working for @OneToMany association
PostPosted: Wed May 09, 2007 7:59 pm 
Beginner
Beginner

Joined: Wed Apr 18, 2007 1:44 pm
Posts: 27
Hi folks,

I have defined this filter

class Product {
....
@OneToMany(mappedBy="target", cascade=CascadeType.ALL)
@Filter(name="productReviewFilter", condition="filtered = false")
private List<Review> reviews = new ArrayList<Review>();
....
}

but one trying to enable it for the session, I get:

session.enableFilter("productReviewFilter");

Exception in thread "main" org.hibernate.HibernateException: No such filter configured [productReviewFilter]

Am I missing something?

TIA
Cheers,
Carlos


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 03, 2009 7:29 pm 
Newbie

Joined: Tue Feb 03, 2009 7:26 pm
Posts: 10
I have same issue. Did you figure this out ?
Hibernate gurus : thoughts ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2009 3:50 am 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
You need to define your filter with @FilterDef.

_________________
-----------------
Need advanced help? http://www.viada.eu


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2009 3:55 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Do you have a @FilterDef annotation?

http://www.hibernate.org/hib_docs/annot ... ec-filters


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2009 4:16 pm 
Newbie

Joined: Tue Feb 03, 2009 7:26 pm
Posts: 10
Not any issue anymore.

Yes I am using FilterDef at class level and the Filter at field level.

The fix was to

HibernateEntityManager hem = (HibernateEntityManager) em;
hem.getSession().enableFilter("filterName").setParameter("param", value);


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.