Skip to content

Not equals query error #26

Description

@ripta101

Hi there,

I am wondering if anyone experience issue with <> (not equal) query.
I am not sure if there is something wrong with my code, or if this actually a bug on SimpleJPA or SimpleDB

I receive below error when using '<>' operand in my query:

Status Code: 400, AWS Request ID: f1f24508-e5c9-b307-7eed-4737e3fb4c2d, AWS Error Code: InvalidQueryExpression, AWS Error Message: The specified query expression syntax is not valid.
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:500)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:262)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:166)
at com.amazonaws.services.simpledb.AmazonSimpleDBClient.invoke(AmazonSimpleDBClient.java:739)
at com.amazonaws.services.simpledb.AmazonSimpleDBClient.select(AmazonSimpleDBClient.java:197)
at com.spaceprogram.simplejpa.DomainHelper.selectItems(DomainHelper.java:57)

I have also tried to use '!=' but it does not seem to work:

javax.persistence.PersistenceException: No getter for field: status !
at com.spaceprogram.simplejpa.query.QueryImpl.appendCondition(QueryImpl.java:365)
at com.spaceprogram.simplejpa.query.QueryImpl.toAmazonQuery(QueryImpl.java:270)
at com.spaceprogram.simplejpa.query.QueryImpl.createAmazonQuery(QueryImpl.java:173)
at com.spaceprogram.simplejpa.query.QueryImpl.getResultList(QueryImpl.java:104)

at

If I remove the <> operand then the query runs with no problem. Here is my code snippet:

....
em = factory.createEntityManager();
Query query = em.createQuery("select s from Stuff s where owner=:owner AND status <> :status AND created is not null order by created desc");
query.setParameter("owner", owner);
query.setParameter("status", status);
return (List)query.getResultList();

....

Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions