-
1. Re: In ejb-jar.xml, is the EJB-QL unprofitable.
christoph Dec 27, 2001 3:30 AM (in response to thisfellow)> ...
> i want make the format of paramter is "name" other
> than "%name%",so i modify the sql to "name
> like '%{0}%'/where>",but a exception is thrown while
> calling the finder.how to correct the sql?
Use "...name like '%' || {0} || '%'" (|| is the concatenation for strings in sql).
Hope to have helped,
Christoph -
2. Re: In ejb-jar.xml, is the EJB-QL unprofitable.
abrasax Jan 7, 2002 8:13 AM (in response to thisfellow)I need to use LIKE with variable parameter. It was told that EJB QL doesn't support LIKE that way. But I need it desperately. I've read in the manual, that JBoss 3.0 enables to overwrite the EJB-QL query with SQL in another place. But I don't know where exactly to put the SQL, so I can't get it work.
I've also tried to write the EJB query in following manner:
SELECT OBJECT(h)
FROM EBHierarchy h
WHERE h.path LIKE CONCAT(?1,'%')
But the JBoss doesn't recognise the CONCAT parameters correctly and creates query like this:
"SELECT t1_h.id FROM Hierarchy t1_h WHERE t1_h.path LIKE CONCAT"
What is wrong? If this query can't be formulated in EJB-QL, how can this be eluded?
Thanx
Martin