This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate challenge: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate challenge:" Watch "Hibernate challenge:" New topic
Author

Hibernate challenge:

kenny lomax
Greenhorn

Joined: Jan 26, 2008
Posts: 2
Hello

I am trying to convince my colleagues to transition to Hibernate instead of using plain SQL and JDBC.
To convince them of Hibernates merits, they would like one of their pet database problems resolved in Hibernate:

imagine 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 HQL I would be really happy, as we can then move to Hibernate

Thanks everyone,
Kenny
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

The easiest way is to create a SQLQeury through Hibernate and not use HQL, so the query will look exactly like the one you would have in JDBC, but with a lot less code to write and maintain.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
wood burning stoves
 
subject: Hibernate challenge:
 
Similar Threads
Optimum Hibernate Mapping for a Tree Model
Foreign Key Constraint Fails
Primitive Types
Hibernate Join Problems
hibernate:many-to-many the association table is not getting populated