-->
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: need to split or substring the result columns
PostPosted: Mon Aug 18, 2008 8:53 am 
Newbie

Joined: Mon Aug 18, 2008 8:38 am
Posts: 1
when i used projections in hibernate i am able to get each propety list using criteria queries....my result will give me a list of NPANXXX Integers
i need first three numbers means NPA of each row ,how to get this using hibernate criteria queries or using HQL queries...

i do not want to iterate resultset or list of columns and get sub string of those result set...i need all sub string logic should happen at Data base only.............
example:

201xxxx
202xxxx
203xxxx,

i need my result as

201
202
203


Plz help me ,







Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Last edited by kdubbaka on Mon Aug 18, 2008 9:49 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: need to split or substring the result columns
PostPosted: Mon Aug 18, 2008 9:31 am 
Newbie

Joined: Wed Jul 23, 2008 2:50 am
Posts: 16
you can use java string manipulation.....

st = st.getsubstring(0,3);


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 19, 2008 2:36 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Check the documentation for your database. Hibernate usually maps database-specific functions to HQL. For example, if I use MySQL I can use the substring() function in HQL.

http://dev.mysql.com/doc/refman/5.1/en/ ... _substring


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.