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.  [ 1 post ] 
Author Message
 Post subject: Query by example and one(many)-to-many assosations
PostPosted: Wed Aug 16, 2006 4:49 am 
Newbie

Joined: Wed Aug 16, 2006 3:35 am
Posts: 2
I'm working on a complex search routine.
I like to search some letters by their keywords.
Each letter can have one or more keywords attached to it.
Suppose that somebody wants to search for some letters that they have 'ERP' ,'MIS' and 'SALES' keywords one can write this SQL statement:
I wrote this :
Code:
Letter letter=new Letter();
letter.Keywords.Add(Keywords.GetByName("ERP"));
letter.Keywords.Add(Keywords.GetByName("MIS"));
letter.Keywords.Add(Keywords.GetByName("SALES"));
.
.
.
using(ISession session=DAL.OpenSession())
{
return session.CreateCriteria(typeof(Letter)).Add(Example.Create(letter)).List();
}

and I got all letters :(
Is there anyway that we can use QBE to solve this problem ?
[/code]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.