-->
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: How can I use a collection condition in a filter?
PostPosted: Mon May 26, 2008 9:54 pm 
Newbie

Joined: Mon May 26, 2008 9:29 pm
Posts: 1
Hibernate version:3.2.6
Following is a snippet of my mapping file:
<class entity-name="Object1" >
<id name="id" type="java.lang.Long">
<column name="Id" />
<generator class="identity" />
</id>
<property name="f1" type="java.lang.String">
<column name="f_1" length="100" not-null="false"/>
</property>
<property name="f2" type="java.lang.String">
<column name="f_2" length="100" not-null="false"/>
</property>
<filter name="access"
condition="f_1 in (:collection)"/>
</class>
<filter-def name="access">
<filter-param name="collection" type="?"/>
</filter-def>

My question is which type I should use here and which kind of parameter I should put into the Filter.setParameter method at runtime?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 26, 2008 11:49 pm 
Regular
Regular

Joined: Sun Apr 13, 2008 3:04 am
Posts: 71
Location: Bangalore
true u have use setParameter

see the example in page 578 of persistance with hibernate book.

syntax for fiter enabling and seeting the parameters is..

Filter filter = session.enableFilter("limitItemsByUserRank");
filter.setParameter("currentUserRank", loggedInUser.getRanking());

Regards,
Nagendra

_________________
Raja Nagendra Kumar,
C.T.O
http://www.tejasoft.com
TejaSoft - Specialists in Code Audit, Unit Testing and Merciless Re-factoring - Engineering Crisis Turnaround Experts


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.