openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sreedhar.sirigiri" <sreedhar.sirig...@gmail.com>
Subject JPQL Exception
Date Wed, 04 Jul 2007 13:41:27 GMT

Hi All,

I'm using the following code to execute JPQL.

			StringBuffer strBuff = new StringBuffer(30);
			strBuff.append("select model from UserDTO model ");
            if (name != null && name.length() > 0) {
				strBuff.append(" where UPPER(model.name) like
'%"+(name.toUpperCase())+"%' ");
			}
			strBuff.append(" order by UPPER(model.name) asc");

But I get the following exception. When I remove UPPER in the last line of
code it is executing without any failure. Shouldn't I use UPPER after
order?? What I could make out from the following trace is, JPQL is expecting
a column name instead of a UPPER(model.name). Any help or suggestions.

<0.9.7-incubating nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: An error occurred while
parsing the query filter 'select model from UserDTO model  order by
UPPER(model.name) asc'. Error message: <0.9.7-incubating nonfatal user
error> org.apache.openjpa.kernel.jpql.ParseException: Encountered "UPPER" at
character 43, but expected: [<IDENTIFIER>].

Sreedhar
-- 
View this message in context: http://www.nabble.com/JPQL-Exception-tf4024517.html#a11431186
Sent from the OpenJPA Developers mailing list archive at Nabble.com.


Mime
View raw message