-->
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.  [ 3 posts ] 
Author Message
 Post subject: Criteria sqlRestriction using created aliases
PostPosted: Thu Feb 14, 2008 10:18 am 
Newbie

Joined: Mon Feb 04, 2008 7:42 am
Posts: 7
Hibernate version: 3.2.5

Name and version of the database you are using:Oracle

I am trying to create a Criteria query using aliases. Currently I have

Code:
Criteria criteria = hibernateSession.createCriteria(Hotel.class);
criteria.createAlias("address", "address");
criteria.add(Restrictions.eq("address.street1", "some street"));


This works as I expected, however I would like to take away case sensitivity. I can do this on a Hotel field by doing:

Code:
criteria.add(Restrictions.sqlRestriction("lower({alias}.hotl_name) = lower(?)", "some name", Hibernate.STRING));


which works.

But how do I do this on a created alias field?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 14, 2008 10:37 am 
Senior
Senior

Joined: Fri Jun 01, 2007 12:41 pm
Posts: 121
Did you try Restrictions.ilike() -->

Code:
criteria.add(Restrictions.ilike("address.street1", "some street"));


Top
 Profile  
 
 Post subject: cheers
PostPosted: Thu Feb 14, 2008 11:56 am 
Newbie

Joined: Mon Feb 04, 2008 7:42 am
Posts: 7
cheers


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