private Key insert ( Entity entity ) throws DatastoreException { CommitRequest req = CommitRequest . newBuilder ( ) . addMutations ( Mutation . newBuilder ( ) . setInsert ( entity ) ) . setMode ( CommitRequest . Mode . NON_TRANSACTIONAL ) . build ( ) ; return datastore . commit ( req ) . getMutationResults ( 0 ) . getKey ( ) ; }
Insert an entity into the datastore .