@ SuppressWarnings ( "unchecked" ) public < E > E update ( E entity ) { try { entityManager . executeEntityListeners ( CallbackType . PRE_UPDATE , entity ) ; Intent intent = ( nativeWriter instanceof Batch ) ? Intent . BATCH_UPDATE : Intent . UPDATE ; Entity nativeEntity = ( Entity ) Marshaller . marshal ( entityManager , entity , intent ) ; nativeWriter . update ( nativeEntity ) ; E updatedEntity = ( E ) Unmarshaller . unmarshal ( nativeEntity , entity . getClass ( ) ) ; entityManager . executeEntityListeners ( CallbackType . POST_UPDATE , updatedEntity ) ; return updatedEntity ; } catch ( DatastoreException exp ) { throw DatastoreUtils . wrap ( exp ) ; } }
Updates the given entity in the Cloud Datastore . The passed in Entity must have its ID set for the update to work .