PDA

View Full Version : EJB Query language


tumelo
07-10-2007, 02:11 PM
here is my query:

query ="SELECT a FROM X a WHERE " +"a.level = :l and a.site = :s and a.code like ':code%'")

my problem is tht im getting an exception saying [testng] javax.ejb.EJBException: java.lang.IllegalArgumentException: org.hibernate.QueryParameterException: could not locate named parameter [code]

i basically want to search all values of code that contain the value of the parameter code thts y i have the % after it. for instance, if cud is 123 then
123*** should be returned as well. please help!

cash1981
07-11-2007, 01:09 PM
It would be easier for us if you use real table and alias names instead a b x

Also you should always try your selects first in the sql database and then when you see it works, then you can try from java.