• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

string function LOCATE of EJB-QL

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have a question about the string function LOCATE of EJB-QL.

The book Enterprise JavaBeans by Monson-Haefel says that the correct use of the LOCATE method is as exemplified by

SELECT OBJECT(c) FROM Customer c WHERE � LOCATE(c.lastName, �Monson�)>-1

This query is supposed to return all Customers having �Monson� in their last name, but in Jboss 4.0 it only works when you write

SELECT OBJECT(c) FROM Customer c WHERE � LOCATE( �Monson�, c.lastName)>0.

I.e. in Jboss the string index starts at 1 (like in JDBC), not found returns 0, and the order of the arguments to LOCATE are the opposite as in Monson-Haefels example.

The specification does not specify the use of LOCATE but refer to a book

quote:
---
These functions are a subset of the functions defined for JDBC 2.0 drivers, as described in Appendix A in JDBC API tutorial and Reference, Second Edition.�
---

I do not have the book �JDBC API tutorial and Reference, Second Edition� at the time of writing.

What is the correct use of LOCATE? Is it JBoss or Monson-Haefel who got it right?

Kind regards
Christian

[ July 10, 2004: Message edited by: Christian Dauer Th. Sellberg ]
[ July 10, 2004: Message edited by: Christian Dauer Th. Sellberg ]
 
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The spec not only doesnt define the return value explicitly, the reference to another book is only made in small font found under the bottom of the page. I dont understand why such an important information is treated with such an indifferent attitude.
 
My pie came with a little toothpic holding up this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic