CrudRepository中不见merge或update的踪影

看CrudRepository接口,进去一看,说好的crud,可是怎么不见merge或update呢?

再一看save注释:

 

/**
	 * Saves a given entity. Use the returned instance for further operations as the save operation might have changed the
	 * entity instance completely.
	 * 
	 * @param entity
	 * @return the saved entity
	 */
	<S extends T> S save(S entity);

这。。。

点进去看一看有哪些实现。。。

只有SimpleJpaRepository中的实现:

 

/*
	 * (non-Javadoc)
	 * @see org.springframework.data.repository.CrudRepository#save(java.lang.Object)
	 */
	@Transactional
	public <S extends T> S save(S entity) {

		if (entityInformation.isNew(entity)) {
			em.persist(entity);
			return entity;
		} else {
			return em.merge(entity);
		}
	}

 

 

 

 

 

你可能感兴趣的:(spring data jpa)