Merging the updated entity into the current persistence context is unnecessary. Changes in managed entities are automatically flushed  when the persistence session ends (usually at the end of a transaction). The former lines are totally sufficient, are well tested and working.