quote: find will work even outside of the active transaction, but not remove.
i think this is incorrect, because find always work inside the existing transaction. So here i can say is that- when the entity is unmanged, doing find will make it managed entity.
Your thought totally incorrect according to the spec. See jpa spec 3.1.1 EntityManager Interface
The find and getReference methods are not required to be invoked within a transaction context. If
an entity manager with transaction-scoped persistence context is in use, the resulting entities will be
detached; if an entity manager with an extended persistence context is used, they will be managed. See
section 3.3 for entity manager use outside a transaction
According to the spec my explanation is correct.
in other words only managed entities can be removed. that means to use remove method you need a managed entity not just id. so there is no remove(Id) method
Correct.
quote:you can implement your own remove method as follows
em.remove(em.find(clazz,id))
this is execellent, thanks Chaminda.