As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
Data store access from Google App Engine using the Java SDK requires user login?
A
Arun Venkatesan
started a topic
about 9 years ago
I'm trying to access a collection in Kinvey using the new Java SDK from Google App Enigne. I'm following the guide here: http://devcenter.kinvey.com/java/guides/datastore and I am getting a NullPointerException: No Active User - please login a user by calling myClient.user().login();
I'm trying to access a datastore that was primarily used by the Google App Engine business logic to store and update date. It is not directly used by the users in anyway. I was able to do this using the collection_access module that was part of the Kinvey App Engine SDK.
Since you don't need to worry about managing a user's lifecycle and your app engine code is in a controlled environment, we recommend authenticating with your app's `appkey` as the username and `master secret` as the password:
That worked. However, I also need to make an update to the User collection from Google App Engine, and being logged in with the AppKey and MasterSecret does not seem to allow this. In fact it looks like you can't query the User collection at all, even if logged in as the user, without using the .user() methods.
Is there a better way to update/modify the User collection from Google App Engine without logging in as the User and without using the .user() methods?
E
Edward
said
about 9 years ago
Is there a reason you don't want to use the `.user()` methods?
For example, this method lets you pass a `Query` object and returns an array of users: http://devcenter.kinvey.com/android/reference/api/java/reference/com/kinvey/java/User.html#retrieveBlocking(com.kinvey.java.Query)
A
Arun Venkatesan
said
about 9 years ago
Thanks Edwards,
Ah, I think that's what I was looking for, however, that method returns a Retrieve Request, how do I then get the User I am querying for?
This returns a retrieve request, so how do I execute this request?
A
Arun Venkatesan
said
about 9 years ago
I guess the documentation describes it differently. But I was able to resolve this simply by casting the return value of the retrieveBlocking() method to a User [].
So essentially what worked for me was:
Query userQuery = javaClient.query();
userQuery.equals("customer_id", 12345);
User user[] = (User[]) javaClient.user().retrieveBlocking(userQuery).execute();
Edward, thanks for your help.
A
Arun Venkatesan
said
about 9 years ago
Is there a similar way to delete a user from the system? I am able to update the user, but deleting the user returns an "abstractKinveyClient must not be null"
I tried the following:
Query userQuery = javaClient.query();
userQuery.equals("customer_id", 12345);
User user[] = (User[]) javaClient.user().retrieveBlocking(userQuery).execute();
with the above code in place,
// this works
User updatedUser = javaClient.user().updateBlocking(user[0]).execute();
Arun Venkatesan
I'm trying to access a datastore that was primarily used by the Google App Engine business logic to store and update date. It is not directly used by the users in anyway. I was able to do this using the collection_access module that was part of the Kinvey App Engine SDK.
What's the best way to do this with the Java SDK?