Interface JPAManipulations

  • All Known Subinterfaces:
    JPAManipulationsForObjectType<ID>

    public interface JPAManipulations
    Interface to implement some common manipulations in JPA.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void forceLoad()
      descend through an object tree to force loading of lazily loaded collections.
      void jpaClone​(jakarta.persistence.EntityManager em)
      Deep clone entity by detaching.
      void persistRefs​(jakarta.persistence.EntityManager em)
      Persist any references in the object tree.
    • Method Detail

      • forceLoad

        void forceLoad()
        descend through an object tree to force loading of lazily loaded collections.
      • jpaClone

        void jpaClone​(jakarta.persistence.EntityManager em)
        Deep clone entity by detaching. Note that references are left alone.
        Parameters:
        em - the entity manager
            MyEntity to_clone = entityManager.find(MyEntity.class, ID);
            to_clone.jpaClone(entityManager);
            entityManager.merge(to_clone);
         
      • persistRefs

        void persistRefs​(jakarta.persistence.EntityManager em)
        Persist any references in the object tree. This exists to aid initial persistence of a model instance, as no JPA operations (apart from refresh) are cascaded to references. References lifecycle is expected to be managed separately.
        Parameters:
        em - the entity manager