I created java application (myLocalAPP) to connect and access google cloud datastore. So, I use Google cloud Datastore API. However, I'm now finding that I have to use myLocalAPP in a GAE app. (I export myLocalAPP to jar and add it to GAE /lib).
The problem is that GAE has different API to connect to Google datastore and the connection,insert and retrieve methods that I've created them in myLocalAPP aren't working when I call them from GAE application. I got exception such:
java.lang.Error: compilation problems:
The method beginTransaction(TransactionOptions) in the type DatastoreService is not applicable for the arguments (DatastoreV1.BeginTransactionRequest)
The method lookup(DatastoreV1.LookupRequest) is undefined for the type DatastoreService
Entity.Builder cannot be resolved to a type
Type mismatch: cannot convert from DatastoreV1.Entity to Entity
So, I go back to myLocalAPP and try to change the connection method. I change the datastore object from
Datastore datastore = DatastoreFactory.get().create(DatastoreHelper.getOptionsfromEnv()
.dataset(datasetId).build());
to
Datastore datastore = (Datastore )DatastoreServiceFactory.getDatastoreService();
but casting does not work. I need to use DatastoreService object and I have to rewrite the other methods. I would like to know is there any way other than rewriting the code?? and if I rewrite the code using GAE datastore API, is myLocalAPP will work again locally?? (not on GAE).
Thanks,