-->
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: Using Criteria to query datarecords which onclude wildcards
PostPosted: Mon Mar 15, 2010 5:01 am 
Newbie

Joined: Tue Mar 09, 2010 10:57 am
Posts: 2
Hello,

I can query data when the search pattern is supposed to hold the wildcard with the like-operator like this:

Code:
criteria.createCriteria("mycollectionproperty").add(Restrictions.like("mycol", "%"+ queryObject.getMycol() + "%"));


But how can I do it the other way round? Let's say in the database "VPN*" is stored and should match the search-input-string "VPN123"? Furthermore the records in the database can look like this "*VPN" or "VPN*" or "*VPN*" and i have to adjust the query operator accordingly.

Big thx!


Top
 Profile  
 
 Post subject: Re: Using Criteria to query datarecords which onclude wildcards
PostPosted: Mon Mar 15, 2010 5:33 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
you can't do that on a database; you could look into Hibernate Search to see if fulltext search capabilities is what you need.

_________________
Sanne
http://in.relation.to/


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.