Skip to content

Instantly share code, notes, and snippets.

View goodspb's full-sized avatar

Malvin Lok goodspb

View GitHub Profile
@goodspb
goodspb / jpa_save.java
Last active August 21, 2022 05:55
medium JPA
@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 {