-->
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: Need Help.How to put Substring in Hibernate query
PostPosted: Thu Aug 03, 2006 1:18 pm 
Newbie

Joined: Wed Nov 02, 2005 2:03 pm
Posts: 15
I am trying to write Hibernate query.I have one column in database.I want to take numbers from the 2nd position till end of the field and compare it to some number.

Here is the code.

Code:
List Queue = getHibernateTemplate().find("from Task t where t.status = ?   order by t.appointmentDate ",
         new Object[]{new Integer(Constants.OPEN)});
         return Queue;


I want to put condition like if number starting from the 2 nd position of column "visit" is greater than 340.I do'nt know how to use substring method.

I will appriciate you help.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 03, 2006 2:01 pm 
Expert
Expert

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 260
It can give you an idea how to make your hql query. Below one queries visit column for 4 characters from 2nd character whose value is greater than 340.

Code:
from Task t where t.status = ?  and ( substr( t.visit, 2, 4 ) > 340 ) order by t.appointmentDate


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.