File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate challenge:

 
kenny lomax
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic