The entity is still managed when you call save, whether you change the ID or not.
Depending on the primary key generation strategy you would even get an exception when changing the id.
If you want to create a new entity you would need to call EntityManager.detach()
before save.
Example:
Optional<Employee> employee = employeeRepository.findById(1);
if (employee.isPresent()) {
Employee employee1 = employee.get();
employee1.setId(null);
// Remove the entity from the persistence context
em.detach(employee1);
employeeRepository.saveAndFlush(employee1);
}