Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

needs help for EJBQL query

 
Lalit Nagalkar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • 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
 
Debu Panda
author
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • 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
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
another way to get it around by using

like CONCAT('%',CONCAT(?1,'%'))
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I think it was the same for JDBC.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic