@Override
    public void save(Pet pet) {
        if (pet.getId() == null) {
            this.em.persist(pet);
        } else {
            this.em.merge(pet);
        }
    }
JPA implementation of the {@link PetRepository} interface.

@author Mike Keith
@author Rod Johnson
@author Sam Brannen
@author Michael Isvy
@since 22.4.2006
src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaPetRepositoryImpl.java