Package org.apache.openjpa.persistence
Class OpenJPAPersistenceUtil
java.lang.Object
org.apache.openjpa.persistence.OpenJPAPersistenceUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
getIdentifier
(Object entity) Returns the identifier of the persistent entity.static Object
getIdentifier
(OpenJPAEntityManagerFactory emf, 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
Determines whether the attribute on the specified object is loaded and is managed by one of the entity managers.static boolean
isManagedBy
(OpenJPAEntityManagerFactory emf, Object entity) Determines whether the specified state manager is managed by an open broker within the persistence unit of the provided EMF instance.
-
Constructor Details
-
OpenJPAPersistenceUtil
public OpenJPAPersistenceUtil()
-
-
Method Details
-
getIdentifier
Returns the identifier of the persistent entity.- Parameters:
entity
-- Returns:
- The identifier of the entity or null if the entity is not persistent.
-
getIdentifier
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
Determines whether the specified state manager is managed by an open broker within the persistence unit of the provided EMF instance.- Parameters:
emf
- OpenJPAEntityManagerFactorysm
- StateManager- Returns:
- true if this state manager is managed by a broker within this persistence unit.
-
isLoaded
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.
-