EntityManager.remove.">
Jakarta Persistence (JPA) Method

void persist(
  Object entity
)


Make a new entity instance managed and persistent, resulting in its insertion in the database when the persistence context is synchronized with the database, or make a removed entity managed, undoing the effect of a previous call to EntityManager.remove. This operation cascades to every entity related by an association marked cascade=PERSIST. If the given entity instance is already managed, that is, if it already belongs to this persistence context, and has not been marked for removal, it is itself ignored, but the operation still cascades.
Parameters:
entity - a new, managed, or removed entity instance
Throws:
IllegalArgumentException - if the given instance is not an entity.
EntityExistsException - if the given entity is detached (if the entity is detached, the EntityExistsException may be thrown when the persist operation is invoked, or the EntityExistsException or another PersistenceException may be thrown at flush or commit time).
TransactionRequiredException - if there is no transaction when invoked on a container-managed entity manager that is of type PersistenceContextType.TRANSACTION.
Since:
Jakarta Persistence (JPA) 1.0