Top Description Methods
jakarta.persistence

public Interface PersistenceUtil

Known Direct Subinterfaces
jakarta.persistence.PersistenceUnitUtil
Known Direct Implementers
jakarta.persistence.Persistence.PersistenceUtilImpl

Utility interface between the application and the persistence provider(s).

The PersistenceUtil interface instance obtained from the Persistence class is used to determine the load state of an entity or entity attribute regardless of which persistence provider in the environment created the entity.

Since
2.0

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

false if entity's state has not been loaded or if the attribute state has not been loaded, else true
isLoaded
(Object
entity containing the attribute
entity
,
String
name of attribute whose load state is to be determined
attributeName
)

Determine the load state of a given persistent attribute.

public boolean

Returns:

false if the entity has not been loaded, else true
isLoaded
(Object
whose load state is to be determined
entity
)

Determine the load state of an entity.

Method Detail

isLoadedback to summary
public boolean isLoaded(Object entity, String attributeName)

Determine the load state of a given persistent attribute.

Parameters
entity:Object

entity containing the attribute

attributeName:String

name of attribute whose load state is to be determined

Returns:boolean

false if entity's state has not been loaded or if the attribute state has not been loaded, else true

isLoadedback to summary
public boolean isLoaded(Object entity)

Determine the load state of an entity. This method can be used to determine the load state of an entity passed as a reference. An entity is considered loaded if all attributes for which FetchType#EAGER has been specified have been loaded.

The isLoaded(Object, String) method should be used to determine the load state of an attribute. Not doing so might lead to unintended loading of state.

Parameters
entity:Object

whose load state is to be determined

Returns:boolean

false if the entity has not been loaded, else true