List of usage examples for org.springframework.data.repository.core EntityInformation isNew
boolean isNew(T entity);
From source file:example.springdata.jpa.compositions.FlushOnSaveRepositoryImpl.java
/** * @param entity/*w w w . j ava2s .co m*/ */ private <S extends T> void doSave(S entity) { EntityInformation<Object, S> entityInformation = getEntityInformation(entity); if (entityInformation.isNew(entity)) { entityManager.persist(entity); } else { entityManager.merge(entity); } }