Class OpenJPAPersistenceUtil


  • public class OpenJPAPersistenceUtil
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object getIdentifier​(java.lang.Object entity)
      Returns the identifier of the persistent entity.
      static java.lang.Object getIdentifier​(OpenJPAEntityManagerFactory emf, java.lang.Object entity)
      Get the object identifier for a persistent entity managed by one of the entity managers of the specified entity manager factory.
      static jakarta.persistence.spi.LoadState isLoaded​(java.lang.Object obj, java.lang.String attr)
      Determines whether the attribute on the specified object is loaded and is managed by one of the entity managers.
      static boolean isManagedBy​(OpenJPAEntityManagerFactory emf, java.lang.Object entity)
      Determines whether the specified state manager is managed by an open broker within the persistence unit of the provided EMF instance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OpenJPAPersistenceUtil

        public OpenJPAPersistenceUtil()
    • Method Detail

      • getIdentifier

        public static java.lang.Object getIdentifier​(java.lang.Object entity)
        Returns the identifier of the persistent entity.
        Parameters:
        entity -
        Returns:
        The identifier of the entity or null if the entity is not persistent.
      • getIdentifier

        public static java.lang.Object getIdentifier​(OpenJPAEntityManagerFactory emf,
                                                     java.lang.Object entity)
        Get the object identifier for a persistent entity managed by one of the entity managers of the specified entity manager factory.
        Returns:
        The identifier of the entity or null if the entity does not have an identifier assigned or is not managed by any of the entity managers of the entity manager factory.
      • isManagedBy

        public static boolean isManagedBy​(OpenJPAEntityManagerFactory emf,
                                          java.lang.Object entity)
        Determines whether the specified state manager is managed by an open broker within the persistence unit of the provided EMF instance.
        Parameters:
        emf - OpenJPAEntityManagerFactory
        sm - StateManager
        Returns:
        true if this state manager is managed by a broker within this persistence unit.
      • isLoaded

        public static jakarta.persistence.spi.LoadState isLoaded​(java.lang.Object obj,
                                                                 java.lang.String attr)
        Determines whether the attribute on the specified object is loaded and is managed by one of the entity managers. Use isManagedBy() to determine if an object is managed by a specific entity manager factory.
        Returns:
        LoadState.LOADED - if the attribute is loaded. LoadState.NOT_LOADED - if the attribute is not loaded or any EAGER fetch attributes of the entity are not loaded. LoadState.UNKNOWN - if the entity is not managed by this provider or if it does not contain the persistent attribute.