Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8918773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:50:06+00:00 2026-06-15T05:50:06+00:00

I have a EntityKind SuggestedInterest. When I populate that with a key GrpId and

  • 0

I have a EntityKind SuggestedInterest.
When I populate that with a key “GrpId” and property “suggestedint”.

Now, I need the “suggestedint” value for a requested “GrpId”

So, I write the query as:

String findSuggestedInterest(String grpId)
{
    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
    Filter filter = new FilterPredicate(Entity.KEY_RESERVED_PROPERTY,FilterOperator.EQUAL,grpId);
    Query q0 = new Query("SuggestedInterest").setFilter(filter);
    PreparedQuery pq0 = datastore.prepare(q0);
    Entity result = pq0.asSingleEntity();
    return result.getProperty("suggestedint").toString();       
}

When I execute this code I get

java.lang.IllegalArgumentException: __key__ filter value must be a Key

The developer docs told to use Entity.KEY_RESERVED_PROPERTY to query on keys, but I guess I misunderstood. What is the correct way to query on key ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:50:07+00:00Added an answer on June 15, 2026 at 5:50 am

    You should pass it a Key instead of String:

    Key grpKey = KeyFactory.createKey("SuggestedInterest", grpId)
    

    then use it:

     Filter filter = 
        new FilterPredicate(Entity.KEY_RESERVED_PROPERTY,FilterOperator.EQUAL,grpKey);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query that calculates the hours worked from dates which includes times.
I have a collection containing a LOT of Data Transfer Objects that I need
I have a property EntityID in a class. Resharper (5.1) says Name 'EntityID' does
suppose that I have this RDBM table ( Entity-attribute-value_model ): col1: entityID col2: attributeName
I have the fallowing mapping: <class name=Country table=Country lazy=false > <cache usage=read-write/> <id name=Id
I have 2 autogenerated entities : @interface ContactEntity : Entity @property (nonatomic, retain) NSString
I have an EntityId class that servers as a simple wrapper class to database
I have a table with columns like entityID, entityName, parentID How can I write
I Have a entity with a property referencing other entity (ReferenceEntity in examples). With
I have a bit of code that tells you when a contact would not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.