-->
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: get varchars that contain numbers and ignore others
PostPosted: Sat Jan 26, 2008 5:49 pm 
Newbie

Joined: Sat Jan 26, 2008 5:42 pm
Posts: 1
Hello

I am trying to convince my colleagues to transition to Hibernate instead of using plain SQL and JDBC.
To convince them of Hibernate's merits, they would like one of their pet database problems resolved in Hibernate, and for it to be fast..

A database table with three columns: NAME (string), ID(long), DESCRIPTION(string)

The task is to retrieve all those entries in the table whose description cell contains a (string representation of an) integer (some will contain words and other non integer strings) and to order the resulting collection of rows.
If anyone could please tell me how to do this, with good performance, with HQL I would be really happy, as we can then finally move to Hibernate :)

Many thanks
Kenny


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 26, 2008 8:18 pm 
Regular
Regular

Joined: Mon Aug 20, 2007 6:47 am
Posts: 74
Location: UK
Hi kennylomax,

I'm not yet a Hibernate expert (about 4 months experiance) but I don't think this kind of problem is something Hibernate is aiming to solve, to be honest. Your best shot at getting that kind of information quickly from the database is to come up with a stored procedure, or perhaps cache the entire contents of the table permanently so you can do it fairly quickly in Java?

Another idea - why not add a column is_number that you set every time you update a row. Queries would be fast as anything then, the only cost is on insert/update having to check if DESCRIPTION can be parsed as an Integer.


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.