File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes How to get the starting position of a string using hibernate query. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to get the starting position of a string using hibernate query." Watch "How to get the starting position of a string using hibernate query." New topic
Author

How to get the starting position of a string using hibernate query.

Hariharan.S
Greenhorn

Joined: May 25, 2005
Posts: 7
Hi

How to get the starting position of a string using hibernate query. For example we will use �patindex� to get the position of the string in sqlserver. It will return an integer value based on the starting position of the given string .

Thanks.
Hari.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

"Hariharan"

Welcome to JavaRanch!

As other have already pointed out, your display name does not comply with our Naming Policy. In particular it must include both first and last name. Please change it here. Thanks!


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

There is nothing in HQL that matches this. You could use T-SQL directly, since Hibernate supports the use of platform-specific SQL (see the createSQLQuery method) however this would break portability. Doing the work in your application via Java might be the best way though.
Scott Johnson
Ranch Hand

Joined: Aug 24, 2005
Posts: 518
Another alternative is to move the call to patindex() to a stored procedure and call the procedure from Hibernate. The procedure could return the position as a single scalar.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get the starting position of a string using hibernate query.
 
Similar Threads
Hibernate
How to determine where to position a jQuery UI dialog?
Hibernate and Weblogic
Row counts with Hibernate Criteria
JPA Native Query