Coder Social home page Coder Social logo

Not equals query error about simplejpa HOT 2 OPEN

appoxy avatar appoxy commented on September 6, 2024
Not equals query error

from simplejpa.

Comments (2)

treeder avatar treeder commented on September 6, 2024

I believe "not equal" in SimpleDB is: !=

Can you try that?

On Wed, Feb 22, 2012 at 7:52 AM, mautdunia <
[email protected]

wrote:

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.


Reply to this email directly or view it on GitHub:
#26

from simplejpa.

ripta101 avatar ripta101 commented on September 6, 2024

yes, I have tried that, but it returns an exception on QueryImpl class as seen above....

I think somehow SimpleJPA use "<>" for "not equal" operand (based on http://code.google.com/p/simplejpa/wiki/JPAQuery) while SimpleDB expect it to be "!=" (based on http://docs.amazonwebservices.com/AmazonSimpleDB/latest/DeveloperGuide/UsingSelectOperators.html)

from simplejpa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.