Originally posted by krishna bulusu:
<blockquote>code:
<pre name="code" class="core">
entityManager.remove(entityManager.merge(employee));
</pre>
In the above code, before deleting the employee object, the entity manager make sure that it is synchronize with the database.
Hope this helps.
</blockquote>
Merge operation does not synchronize object state with a database, it just makes the instance managed, so it can be used in remove method.