BeginTransactionRequest.Builder request = BeginTransactionRequest.newBuilder();
request.setCrossGroup(options.isXG());
Future<BeginTransactionResponse> future = datastoreProxy.beginTransaction(request.build());
ApiVersion apiVersion = datastoreServiceConfig.getApiVersion();
switch (apiVersion) {
case CLOUD_DATASTORE:
return InternalTransactionCloudDatastore.create(datastoreProxy, future);
case V4:
return InternalTransactionV4.create(datastoreProxy, future);