-->
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: FilterDef problem
PostPosted: Mon May 05, 2008 1:01 pm 
Newbie

Joined: Mon May 05, 2008 8:48 am
Posts: 1
Hello I have small problem with filter definition. I use in my project nhibernate mapping attributes and I want define new nhibernate filter with one named parameters.

I use this mapping:

[NHibernate.Mapping.Attributes.FilterDef(0, Name = "CurrentUserFilter",
Condition = "user_id = :user_id")]
[NHibernate.Mapping.Attributes.FilterParam(1,Name= "CurrentUser",Type = "String")]
[NHibernate.Mapping.Attributes.Filter(2, Name= "CurrentUserFilter",Condition = "user_id = :user_id")]

[NHibernate.Mapping.Attributes.List(3, Name = "UserViews", Table =
"users_views", Access = "field.camelcase-underscore", Lazy = false)]
[NHibernate.Mapping.Attributes.Key(4, Column ="business_object_id")]
[NHibernate.Mapping.Attributes.Index(5, Column= "userView_index",
TypeType=typeof(string))]
[NHibernate.Mapping.Attributes.OneToMany(6, Class = "UserView",ClassType = typeof(UserView))]

IList<UserView> _userViews = new List<UserView>();

When I try enable CurrentUserFilter in Nhibernate session
Nhibernate throw NhibernateExecption with message "No such filter definition". There are small examples with attributes

Can you help me ?


Top
 Profile  
 
 Post subject: I second this problem
PostPosted: Tue Jul 29, 2008 2:55 pm 
Newbie

Joined: Thu Jun 02, 2005 12:00 pm
Posts: 8
I'm having the exact same problem.

It's a bug with the mapping attributes. If you look at the mapping file that the attributes create, you'll notice that there is no <filter-def /> section at all. The <filter-def /> section needs to go under the "root" of the mapping file and in order to do that you'd have to put the [FilterDef] attribute on a class or in it's own file or something. But the [FilterDef] attribute can only go on a property, indexer, or member in the C# code.

It's impossible to put the [FilterDef] attribute in the correct place!

-Tim Gebhardt
tim@gebhardtcomputing.com


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.