'or' filters can only check equality

32 views
Skip to first unread message

Vikas Hazrati

unread,
Jul 14, 2010, 3:02:18 AM7/14/10
to Google App Engine
Hi,

We have the following named query in JPA which we want to execute on
the datastore

@NamedQuery(name="User.findActiveByUsernamePattern",
query="SELECT DISTINCT user " +
"FROM User as user " +
"WHERE firstName like :pattern OR lastName like :pattern " +
"AND active = true " +
"ORDER BY firstName")

when we execute the test, we get the following error

org.datanucleus.store.appengine.query.DatastoreQuery
$UnsupportedDatastoreFeatureException: Problem with query <SELECT FROM
User as user WHERE firstName like :pattern OR lastName like :pattern
AND active = true ORDER BY firstName>: 'or' filters can only check
equality

What is the best way to resolve this? we can write 2 queries one for
firstName and other for lastname but that is ugly.

Regards | Vikas
www.inphina.com
www.thoughts.inphina,com
Reply all
Reply to author
Forward
0 new messages