Last active
August 21, 2022 05:55
-
-
Save goodspb/68a895e1be472621af71e75813169147 to your computer and use it in GitHub Desktop.
medium JPA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Transactional | |
@Override | |
public <S extends T> S save(S entity) { | |
Assert.notNull(entity, "Entity must not be null."); | |
if (entityInformation.isNew(entity)) { | |
em.persist(entity); | |
return entity; | |
} else { | |
return em.merge(entity); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment