@ApiMethod(name = "storeTask") public void storeTask(TaskBean taskBean) { DatastoreService datastoreService = DatastoreServiceFactory.getDatastoreService(); Transaction txn = datastoreService.beginTransaction(); try { Key taskBeanParentKey = KeyFactory.createKey("TaskBeanParent", "todo.txt"); Entity taskEntity = new Entity("TaskBean", taskBean.getId(), taskBeanParentKey); taskEntity.setProperty("data", taskBean.getData()); datastoreService.put(taskEntity); txn.commit(); } finally { if (txn.isActive()) { txn.rollback(); } } }