-->
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.  [ 4 posts ] 
Author Message
 Post subject: Can i use disjunction with associated entity using criteria
PostPosted: Sun Dec 19, 2010 9:17 am 
Newbie

Joined: Sun Dec 19, 2010 9:09 am
Posts: 2
Hi all

i have a two tables

class class1
{

String text1
...
List<Class2> list;
}

Class Class2
{
String text2
}

the condition i have to make is

text1 like "value" OR text2 like "value"

how can i make this relation with criteria
thanks ...


Top
 Profile  
 
 Post subject: Re: Can i use disjunction with associated entity using criteria
PostPosted: Mon Dec 20, 2010 6:51 am 
Regular
Regular

Joined: Fri Nov 12, 2010 4:13 am
Posts: 81
Location: India
Try this,

Code:
criteria.add(Restrictions.or(Restrictions.ilike(text1, value),Restrictions.ilike(text2, value)));



Hope this will help you.


Chirag

_________________
Thanks & Regards,
Chirag


Top
 Profile  
 
 Post subject: Re: Can i use disjunction with associated entity using criteria
PostPosted: Sat Dec 25, 2010 7:36 am 
Newbie

Joined: Sun Dec 19, 2010 9:09 am
Posts: 2
thanks

that cant run because the text2 property in different criteria (sub criteria )


Top
 Profile  
 
 Post subject: Re: Can i use disjunction with associated entity using criteria
PostPosted: Mon Dec 27, 2010 12:51 am 
Regular
Regular

Joined: Fri Nov 12, 2010 4:13 am
Posts: 81
Location: India
Ya but you can use class two property also.

_________________
Thanks & Regards,
Chirag


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