• 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

needs help for EJBQL query

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi everybody
I am using following EJBQL query in my app deployed succesfully on jBoss 4.0.4
But I am not getting anything from the querry the size of result is always 0 I mean the querry retuns no elements from the DB but there are rows satisfying the query.
------------------------------------------------
method signature:> public java.util.Collection findByName(String name)throws FinderException, RemoteException

EJBQL:> SELECT OBJECT(a) FROM item AS a WHERE a.name LIKE '%?1%'
------------------------------------------------

Also is there any tool that can show what class and/or querry the container has generated for our CMP-EJB and EJBQL.

Thanks,
Lalit
 
author
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not a JBoss expert. But you can use P6SPY to see what SQL was executed by a CMP engine.http://www.p6spy.com/documentation/index.htm

If I remember correctly EJBQL does not allow %with a parameter

Can you try changing:

a.name LIKE '%?1%'

To

a.name LIKE '?1'

Pass the parameter that has % as follows:

'%'+mystring+'%'
 
Debu Panda
author
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
another way to get it around by using

like CONCAT('%',CONCAT(?1,'%'))
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I think it was the same for JDBC.
reply
    Bookmark Topic Watch Topic
  • New Topic