Reputation: 5389
I'm trying to do something relatively straightforward and something I think I used to be able to do.
I'm trying to use the admin interface to query my datastore using a long id. The entity in question is defined as:
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
public class Notification
{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long notificationId = null;
}
In the datastore viewer in the appengine admin interface, I perform the following gql query:
SELECT * FROM Notification WHERE _key_ = KEY('Notification', 12345)
SELECT * FROM Notification WHERE id = KEY('Notification', 12345)
SELECT * FROM Notification WHERE notificationId = KEY('Notification', 12345)
SELECT * FROM Notification WHERE notificationId = 12345
None of these queries return any results nor do they produce any errors. I am sure the entity exists. OIne of these used to work I just can't remember which. Could this be due to the recent appengine update to 1.3.6?
Upvotes: 3
Views: 1384
Reputation: 101149
You need this:
SELECT * FROM Notification WHERE __key__ = KEY('Notification', 12345)
Note two underscores around key, not one.
Upvotes: 4