Hi Jothi,
The persist() method throws a TransactionRequiredException if this method is invoked on a transaction-scoped persistence context.
what are your doubts about this statement ? The "correction" from O'Reilly sounds
{77} top paragraph;
the second sentence, "TransactionRequiredException is thrown if this method is invoked on a transaction-scoped persistence context." should be "TransactionRequiredException is thrown if this method is NOT invoked on a transaction-scoped persistence context."
This statement is definitely wrong! See JPA spec 3.1.1, page 47:
The persist, merge, remove, and refresh methods must be invoked within a transaction context when an entity manager with a transaction-scoped persistence context is used. If there is no transaction context, the javax.persistence.TransactionRequiredException is thrown.
If the entity manager uses an extended persistence context these methods can be called even without a transaction context.