Top Description Inners Fields Constructors Methods
org.eclipse.persistence.internal.jpa

public Class EntityManagerImpl

extends Object
implements JpaEntityManager
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.jpa.JpaEntityManager, java.lang.AutoCloseable, jakarta.persistence.EntityManager
Imports
java.util.ArrayList, .Collections, .HashMap, .IdentityHashMap, .Iterator, .List, .Locale, .Map, .Set, .WeakHashMap, jakarta.persistence.CacheStoreMode, .EntityExistsException, .EntityGraph, .EntityManager, .EntityManagerFactory, .EntityNotFoundException, .FlushModeType, .LockModeType, .LockTimeoutException, .OptimisticLockException, .PersistenceException, .PessimisticLockException, .Query, .StoredProcedureQuery, .SynchronizationType, .TransactionRequiredException, .TypedQuery, jakarta.persistence.criteria.CriteriaBuilder, .CriteriaDelete, .CriteriaQuery, .CriteriaUpdate, jakarta.persistence.metamodel.Metamodel, javax.sql.DataSource, org.eclipse.persistence.annotations.CacheKeyType, org.eclipse.persistence.config.EntityManagerProperties, .QueryHints, .ReferenceMode, org.eclipse.persistence.descriptors.CMPPolicy, .ClassDescriptor, .VersionLockingPolicy, org.eclipse.persistence.exceptions.DatabaseException, .EclipseLinkException, .JPQLException, .ValidationException, org.eclipse.persistence.expressions.Expression, org.eclipse.persistence.internal.databaseaccess.Accessor, org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy, org.eclipse.persistence.internal.helper.BasicTypeHelperImpl, org.eclipse.persistence.internal.identitymaps.CacheId, org.eclipse.persistence.internal.jpa.querydef.CriteriaDeleteImpl, .CriteriaQueryImpl, .CriteriaUpdateImpl, org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl, .EntityTransactionWrapper, .JTATransactionWrapper, .TransactionWrapper, .TransactionWrapperImpl, org.eclipse.persistence.internal.localization.ExceptionLocalization, org.eclipse.persistence.internal.sessions.AbstractSession, .DatabaseSessionImpl, .MergeManager, .PropertiesHandler, .RepeatableWriteUnitOfWork, .UnitOfWorkImpl, org.eclipse.persistence.jpa.JpaEntityManager, org.eclipse.persistence.logging.SessionLog, org.eclipse.persistence.queries.AttributeGroup, .Call, .DataReadQuery, .DatabaseQuery, .FetchGroupTracker, .ObjectLevelReadQuery, .ReadAllQuery, .ReadObjectQuery, .ResultSetMappingQuery, .SQLResultSetMapping, .StoredProcedureCall, org.eclipse.persistence.sessions.DatabaseSession, .DatasourceLogin, .DefaultConnector, .JNDIConnector, .Session, .UnitOfWork, .UnitOfWork.CommitOrderType, org.eclipse.persistence.sessions.broker.SessionBroker, org.eclipse.persistence.sessions.factories.SessionManager, org.eclipse.persistence.sessions.server.ConnectionPolicy, .Server, .ServerSession

Purpose: Contains the implementation of the EntityManager.

Description: This class provides the implementation for the combined EclipseLink and JPA EntityManager class.

Responsibilities: It is responsible for tracking transaction state and the objects within that transaction.

Author
gyorke
Since
TopLink Essentials - JPA 1.0
See Also
jakarta.persistence.EntityManager, org.eclipse.persistence.jpa.JpaEntityManager

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static enum
pack-priv abstract static class

Field Summary

Modifier and TypeField and Description
protected boolean
beginEarlyTransaction

Join existing transaction property, allows reading through write connection.

protected boolean
cacheStoreBypass

Property to avoid writing to the cache on commit (merge)

protected boolean
closeOnCommit

Property to avoid resuming unit of work if going to be closed on commit anyway.

protected UnitOfWork.CommitOrderType
commitOrder

Allow updates to be ordered by id to avoid possible deadlocks.

protected boolean
protected Map<String, ConnectionPolicy>
connectionPolicies

In case of composite persistence unit this map is used instead of connectionPolicy attribute.

protected ConnectionPolicy
connectionPolicy

Connection policy used to create ClientSession, allows using a different pool/connection/exclusive connections.

protected AbstractSession
databaseSession

References the DatabaseSession that this deployment is using.

protected RepeatableWriteUnitOfWork
extendedPersistenceContext

Stores the UnitOfWork representing the persistence context.

protected EntityManagerFactoryDelegate
factory

References to the parent factory that has created this entity manager.

protected String
flushClearCache

The FlashClearCache mode to be used.

protected FlushModeType
flushMode

Flush mode property, allows flush before query to be avoided.

protected boolean
isOpen

Store if this entity manager has been closed.

protected WeakHashMap<QueryImpl, QueryImpl>
openQueriesMap

Keep a list of openQueries that are executed in this entity manager.

protected boolean
persistOnCommit

Property to avoid discover new objects in unit of work if application always uses persist.

pack-priv static Map<String, EntityManagerImpl.PropertyProcessor>
protected Map<String, Object>
properties

Local properties passed from createEntityManager.

protected AbstractSession
readOnlySession

Stores a session used for read-only queries.

protected ReferenceMode
referenceMode

Reference mode property, allows weak unit of work references to allow garbage collection during a transaction.

protected boolean
shouldValidateExistence

Determine if does-exist should be performed on persist.

protected SynchronizationType
syncType

Tracks if this EntityManager should automatically associate with the transaction or not

private TransactionWrapperImpl
transaction

Allows transparent transactions across JTA and local transactions.

Constructor Summary

AccessConstructor and Description
public
EntityManagerImpl(String
the DatabaseSession name that should be used. This constructor can potentially throw EclipseLink exceptions regarding the existence, or errors with the specified session.
sessionName
)

Constructor returns an EntityManager assigned to the a particular DatabaseSession.

public
EntityManagerImpl(AbstractSession
the databaseSession assigned to this deployment.
databaseSession
,
SynchronizationType syncType)

Constructor called from the EntityManagerFactory to create an EntityManager

public
EntityManagerImpl(AbstractSession
the databaseSession assigned to this deployment.

Note

The properties argument is provided to allow properties to be passed into this EntityManager, but there are currently no such properties implemented

databaseSession
,
Map<K, V> properties, SynchronizationType syncType)

Constructor called from the EntityManagerFactory to create an EntityManager

public
EntityManagerImpl(EntityManagerFactoryDelegate
the EntityMangerFactoryImpl that created this entity manager.

Note

The properties argument is provided to allow properties to be passed into this EntityManager, but there are currently no such properties implemented

factory
,
Map<K, V> properties, SynchronizationType syncType)

Constructor called from the EntityManagerFactory to create an EntityManager

Method Summary

Modifier and TypeMethod and Description
public void
addOpenQuery(QueryImpl query)

Queries that leave the connection and are executed against this entity manager will be added here.

protected Object
checkForTransaction(boolean validateExistence)

Return the current, joined transaction object.

public void
clear()

Implements jakarta.persistence.EntityManager.clear.

Clear the persistence context, causing all managed entities to become detached.
public void
protected void
closeOpenQueries()

Close any open queries executed against this entity manager.0

public boolean
contains(Object
entity instance
entity
)

Implements jakarta.persistence.EntityManager.contains.

Check if the instance belongs to the current persistence context.
protected boolean
contains(Object entity, UnitOfWork uow)

Check if the instance belongs to the current persistence context.

public Object
copy(Object entityOrEntities, AttributeGroup group)

Implements org.eclipse.persistence.jpa.JpaEntityManager.copy.

This method will return copy the passed entity using the passed AttributeGroup.
protected void
createConnectionPolicies(Map<K, V> mapOfProperties)

Create connection policy using properties.

protected void
createConnectionPolicy()

Create connection policy using properties.

protected static ConnectionPolicy
createConnectionPolicy(ServerSession serverSession, Map<K, V> properties)

Create connection policy using properties.

public Query
createDescriptorNamedQuery(String queryName, Class<?> descriptorClass)

Implements org.eclipse.persistence.jpa.JpaEntityManager.createDescriptorNamedQuery.

This method will create a query object that wraps a EclipseLink Named Query.
public Query
createDescriptorNamedQuery(String queryName, Class<?> descriptorClass, List<E> argumentTypes)

Implements org.eclipse.persistence.jpa.JpaEntityManager.createDescriptorNamedQuery.

This method will create a query object that wraps a EclipseLink Named Query.
public <T> EntityGraph<T>
createEntityGraph(Class<T>
class of entity graph
rootType
)

Implements jakarta.persistence.EntityManager.createEntityGraph.

Return a mutable EntityGraph that can be used to dynamically create an EntityGraph.
public EntityGraph<T>
createEntityGraph(String
name of an entity graph
graphName
)

Implements jakarta.persistence.EntityManager.createEntityGraph.

Return a mutable copy of the named EntityGraph.
public Query

Returns:

the new query instance
createNamedQuery
(String
the name of a query defined in metadata
name
)

Implements jakarta.persistence.EntityManager.createNamedQuery.

Create an instance of Query for executing a named query (in EJBQL or native SQL).
public <T> TypedQuery<T>

Returns:

the new query instance
createNamedQuery
(String
the name of a query defined in metadata
name
,
Class<T>
the type of the query result
resultClass
)

Implements jakarta.persistence.EntityManager.createNamedQuery.

Create an instance of TypedQuery for executing a named query (in the Java Persistence query language or in native SQL).
public StoredProcedureQuery

Returns:

the new stored procedure query instance
createNamedStoredProcedureQuery
(String
name assigned to the stored procedure query in metadata
name
)

Implements jakarta.persistence.EntityManager.createNamedStoredProcedureQuery.

Create an instance of StoredProcedureQuery for executing a stored procedure in the database.
public Query

Returns:

the new query instance
createNativeQuery
(String
a native SQL query string
sqlString
)

Implements jakarta.persistence.EntityManager.createNativeQuery.

Create an instance of Query for executing a native SQL query.
public Query
createNativeQuery(String
a native SQL query string
sqlString
,
Class<T>
the class of the resulting instance(s)
resultType
)

Implements jakarta.persistence.EntityManager.createNativeQuery.

This method is used to create a query using SQL.
public Query

Returns:

the new query instance
createNativeQuery
(String
a native SQL query string
sqlString
,
String
the name of the result set mapping
resultSetMapping
)

Implements jakarta.persistence.EntityManager.createNativeQuery.

Create an instance of Query for executing a native SQL query.
public Query
createQuery(Expression expression, Class<?> resultType)

Implements org.eclipse.persistence.jpa.JpaEntityManager.createQuery.

This method is used to create a query using a EclipseLink Expression and the return type.
public Query
createQuery(DatabaseQuery databaseQuery)

Implements org.eclipse.persistence.jpa.JpaEntityManager.createQuery.

This method is used to create a query using a EclipseLink DatabaseQuery.
public <T> TypedQuery<T>
createQuery(CriteriaQuery<T>
a criteria query object
criteriaQuery
)

Implements jakarta.persistence.EntityManager.createQuery.

Create an instance of TypedQuery for executing a criteria query.
public Query
createQuery(Call call)

Implements org.eclipse.persistence.jpa.JpaEntityManager.createQuery.

This method is used to create a query using a EclipseLink Call.
public Query
createQuery(Call call, Class<?> entityClass)

Implements org.eclipse.persistence.jpa.JpaEntityManager.createQuery.

This method is used to create a query using a EclipseLink Call.
public Query

Returns:

the new query instance
createQuery
(String
an JPQL query string
jpqlString
)

Implements jakarta.persistence.EntityManager.createQuery.

Create an instance of Query for executing an JPQL query.
public <T> TypedQuery<T>

Returns:

the new query instance
createQuery
(String
a Java Persistence query string
qlString
,
Class<T>
the type of the query result
resultClass
)

Implements jakarta.persistence.EntityManager.createQuery.

Create an instance of TypedQuery for executing a Java Persistence query language statement.
public Query
createQuery(CriteriaUpdate<T>
a criteria update query object
updateQuery
)

Implements jakarta.persistence.EntityManager.createQuery.

Create an instance of Query for executing a criteria update query.
public Query
createQuery(CriteriaDelete<T>
a criteria delete query object
deleteQuery
)

Implements jakarta.persistence.EntityManager.createQuery.

Create an instance of Query for executing a criteria delete query.
public Query
createQueryByExample(Object exampleObject)

Implements org.eclipse.persistence.jpa.JpaEntityManager.createQueryByExample.

This method is used to create a query using a EclipseLink by example.
protected DatabaseQuery
createQueryInternal(Expression expression, Class<?> resultType)

This method is used to create a query using a EclipseLink Expression and the return type.

public StoredProcedureQuery

Returns:

the new stored procedure query instance
createStoredProcedureQuery
(String
name of the stored procedure in the database
procedureName
)

Implements jakarta.persistence.EntityManager.createStoredProcedureQuery.

Create an instance of StoredProcedureQuery for executing a stored procedure in the database.
public StoredProcedureQuery

Returns:

the new stored procedure query instance
createStoredProcedureQuery
(String
name of the stored procedure in the database
procedureName
,
Class<T>...
classes to which the result sets produced by the stored procedure are to be mapped
resultClasses
)

Implements jakarta.persistence.EntityManager.createStoredProcedureQuery.

Create an instance of StoredProcedureQuery for executing a stored procedure in the database.
public StoredProcedureQuery

Returns:

the new stored procedure query instance
createStoredProcedureQuery
(String
name of the stored procedure in the database
procedureName
,
String...
the names of the result set mappings to be used in mapping result sets returned by the stored procedure
resultSetMappings
)

Implements jakarta.persistence.EntityManager.createStoredProcedureQuery.

Create an instance of StoredProcedureQuery for executing a stored procedure in the database.
public void
detach(Object
entity instance
entity
)

Implements jakarta.persistence.EntityManager.detach.

Remove the given entity from the persistence context, causing a managed entity to become detached.
protected void
private Object
executeQuery(ReadObjectQuery query, LockModeType lockMode, AbstractSession session)

Execute the locking query.

public <T> T

Returns:

the found entity instance or null if the entity does not exist
find
(Class<T>
- the entity class to find.
entityClass
,
Object
- the entity primary key value, or primary key class, or a List of primary key values.
primaryKey
)

Implements jakarta.persistence.EntityManager.find.

Find by primary key.
public <T> T

Returns:

the found entity instance or null if the entity does not exist
find
(Class<T>
entity class
entityClass
,
Object
primary key
primaryKey
,
Map<String, Object>
standard and vendor-specific properties
properties
)

Implements jakarta.persistence.EntityManager.find.

Find by primary key, using the specified properties.
public <T> T

Returns:

the found entity instance or null if the entity does not exist
find
(Class<T>
entity class
entityClass
,
Object
primary key
primaryKey
,
LockModeType
lock mode
lockMode
)

Implements jakarta.persistence.EntityManager.find.

Find by primary key and lock.
public <T> T

Returns:

the found entity instance or null if the entity does not exist
find
(Class<T>
entity class
entityClass
,
Object
primary key
primaryKey
,
LockModeType
lock mode
lockMode
,
Map<String, Object>
standard and vendor-specific properties and hints
properties
)

Implements jakarta.persistence.EntityManager.find.

Find by primary key and lock.
public Object

Returns:

the found entity instance or null, if the entity does not exist.
find
(String
- the entity class to find.
entityName
,
Object
- the entity primary key value, or primary key class, or a List of primary key values.
primaryKey
)

Find by primary key.

protected Object

Returns:

the found entity instance or null, if the entity does not exist.
findInternal
(ClassDescriptor
- the entity class to find.
descriptor
,
AbstractSession session, Object
- the entity primary key value, or primary key class, or a List of primary key values.
id
,
LockModeType lockMode, Map<String, Object> properties)

Find by primary key.

public void
flush()

Implements jakarta.persistence.EntityManager.flush.

Synchronize the persistence context with the underlying database.
public AbstractSession
getAbstractSession()

Implements org.eclipse.persistence.jpa.JpaEntityManager.getAbstractSession.

Return the underlying database session
public RepeatableWriteUnitOfWork
public Session
getActiveSession()

Implements org.eclipse.persistence.jpa.JpaEntityManager.getActiveSession.

This method returns the current session to the requestor.
public AbstractSession
getActiveSessionIfExists()

This method returns the current session to the requestor.

public CriteriaBuilder

Returns:

CriteriaBuilder instance
getCriteriaBuilder
()

Implements jakarta.persistence.EntityManager.getCriteriaBuilder.

Return an instance of CriteriaBuilder for the creation of Criteria API Query objects.
public DatabaseSessionImpl
getDatabaseSession()

Implements org.eclipse.persistence.jpa.JpaEntityManager.getDatabaseSession.

Return the underlying database session
public Object
getDelegate()

Implements jakarta.persistence.EntityManager.getDelegate.

Return the underlying provider object for the EntityManager, if available.
public EntityGraph<T>
getEntityGraph(String
name of an existing entity graph
graphName
)

Implements jakarta.persistence.EntityManager.getEntityGraph.

Return a named EntityGraph.
public <T> List<EntityGraph<? super T>>
getEntityGraphs(Class<T>
entity class
entityClass
)

Implements jakarta.persistence.EntityManager.getEntityGraphs.

Return all named EntityGraphs that have been defined for the provided class type.
public EntityManagerFactory

Returns:

EntityManagerFactory instance
getEntityManagerFactory
()

Implements jakarta.persistence.EntityManager.getEntityManagerFactory.

Return the entity manager factory for the entity manager.
public FlushModeType

Returns:

flushMode
getFlushMode
()

Implements jakarta.persistence.EntityManager.getFlushMode.

Get the flush mode that applies to all objects contained in the persistence context.
public LockModeType
getLockMode(Object
entity instance
entity
)

Implements jakarta.persistence.EntityManager.getLockMode.

Get the current lock mode for the entity instance.
public DatabaseSessionImpl
getMemberDatabaseSession(Class<?> cls)

Implements org.eclipse.persistence.jpa.JpaEntityManager.getMemberDatabaseSession.

Return the member DatabaseSessionImpl that maps cls in session broker.
public ServerSession
getMemberServerSession(Class<?> cls)

Implements org.eclipse.persistence.jpa.JpaEntityManager.getMemberServerSession.

Return the member ServerSession that maps cls in session broker.
public String
getMemberSessionName(Class<?> cls)

Implements org.eclipse.persistence.jpa.JpaEntityManager.getMemberSessionName.

Return the name of member session that maps cls.
public Metamodel

Returns:

Metamodel instance
getMetamodel
()

Implements jakarta.persistence.EntityManager.getMetamodel.

Return an instance of Metamodel interface for access to the metamodel of the persistence unit.
protected Map<QueryImpl, QueryImpl>
getOpenQueriesMap()

Return the weak reference to the open queries.

protected Set<QueryImpl>
getOpenQueriesSet()

Return the weak reference to the open queries.

public Map<String, Object>
getProperties()

Implements jakarta.persistence.EntityManager.getProperties.

Get the properties and associated values that are in effect for the entity manager.
protected String
getPropertiesHandlerProperty(String name)

Get the local EntityManager property from the properties Map.

protected static String
getPropertiesHandlerProperty(String name, String value)

Verifies and (if required) translates the value.

public Object
getProperty(String name)

The method search for user defined property passed in from EntityManager, if it is not found then search for it from EntityManagerFactory properties.

protected HashMap<String, Object>
getQueryHints(Object entity, EntityManagerImpl.OperationType operation)

Before any find or refresh operation, gather any persistence unit properties that should be applied to the query.

protected ReadObjectQuery
getReadObjectQuery(Class<?> referenceClass, Object primaryKey, Map<K, V> properties)

Build a selection query for the primary key values.

protected ReadObjectQuery
getReadObjectQuery(Map<K, V> properties)

Build a selection query using the given properties.

protected ReadObjectQuery
getReadObjectQuery(Object entity, Map<K, V> properties)

Build a selection query for the given entity.

public Session
getReadOnlySession()

Return a read-only session (client session) for read-only operations.

public <T> T

Returns:

the found entity instance.
getReference
(Class<T>
entity class
entityClass
,
Object
primary key
primaryKey
)

Implements jakarta.persistence.EntityManager.getReference.

Get an instance, whose state may be lazily fetched.
public ServerSession
getServerSession()

Implements org.eclipse.persistence.jpa.JpaEntityManager.getServerSession.

Return the underlying server session, throws ClassCastException if it's not a ServerSession.
public Session
getSession()

Implements org.eclipse.persistence.jpa.JpaEntityManager.getSession.

This method will return a Session outside of a transaction and null within a transaction.
public SessionBroker
getSessionBroker()

Implements org.eclipse.persistence.jpa.JpaEntityManager.getSessionBroker.

Return the underlying session broker, throws ClassCastException if it's not a SessionBroker.
public Set<String>

Returns:

property names
getSupportedProperties
()

Get the names of the properties that are supported for use with the entity manager.

public SynchronizationType

Returns:

the syncType
getSyncType
()

INTERNAL: Tracks if this EntityManager should automatically associate with the transaction or not

public EntityTransaction

Returns:

EntityTransaction instance
getTransaction
()

Implements jakarta.persistence.EntityManager.getTransaction.

Returns the resource-level transaction object.
public UnitOfWork
getUnitOfWork()

Implements org.eclipse.persistence.jpa.JpaEntityManager.getUnitOfWork.

This method will return the active UnitOfWork
public boolean
hasActivePersistenceContext()

This method is used in contains to check if we already have a persistence context.

protected void
initialize(Map<K, V> properties)

Initialize the state after construction.

public boolean
isBroker()

Implements org.eclipse.persistence.jpa.JpaEntityManager.isBroker.

Indicates whether the underlying session is a session broker.
public boolean

Returns:

boolean
isFlushModeAUTO
()

Internal method.

public boolean
isJoinedToTransaction()

Implements jakarta.persistence.EntityManager.isJoinedToTransaction.

Determine whether the entity manager is joined to the current transaction.
public boolean
isOpen()

Implements jakarta.persistence.EntityManager.isOpen.

Indicates whether or not this entity manager and its entity manager factory are open.
protected static boolean
isPropertyToBeAdded(String value)

Property value is to be added if it's non null and not an empty string.

protected static boolean
protected static boolean
isPropertyToBeRemoved(String value)

Property value of an empty string indicates that the existing property should be removed.

protected static Boolean

Returns:

null: no change; TRUE: substitute oldValue by newValue; FALSE: remove oldValue
isPropertyValueToBeUpdated
(String oldValue, String newValue)

public void
joinTransaction()

Implements jakarta.persistence.EntityManager.joinTransaction.

Indicate to the EntityManager that a JTA transaction is active.
public void
load(Object entityOrEntities, AttributeGroup group)

Implements org.eclipse.persistence.jpa.JpaEntityManager.load.

This method will load the passed entity or collection of entities using the passed AttributeGroup.
public void
lock(Object
entity instance
entity
,
LockModeType
lock mode
lockMode
)

Implements jakarta.persistence.EntityManager.lock.

Set the lock mode for an entity object contained in the persistence context.
public void
lock(Object
entity instance
entity
,
LockModeType
lock mode
lockMode
,
Map<String, Object>
standard and vendor-specific properties and hints
properties
)

Implements jakarta.persistence.EntityManager.lock.

Set the lock mode for an entity object contained in the persistence context.
public <T> T

Returns:

the instance that the state was merged to
merge
(T
entity instance
entity
)

Implements jakarta.persistence.EntityManager.merge.

Merge the state of the given entity into the current persistence context, using the unqualified class name as the entity name.
protected Object

Returns:

the instance that the state was merged to
mergeInternal
(Object entity)

Merge the state of the given entity into the current persistence context, using the unqualified class name as the entity name.

public void
persist(Object
entity instance
entity
)

Implements jakarta.persistence.EntityManager.persist.

If in a transaction this method will check for existence and register the object if it is new.
protected void
processProperties()

Process the local EntityManager properties only.

public static void
processUnfetchedAttribute(FetchGroupTracker entity, String attributeName)

INTERNAL: Load/fetch the unfetched object.

public static void
processUnfetchedAttributeForSet(FetchGroupTracker entity, String attributeName)

INTERNAL: Load/fetch the unfetched object.

public void
refresh(Object
instance registered in the current persistence context.
entity
)

Implements jakarta.persistence.EntityManager.refresh.

Refresh the state of the instance from the database.
public void
refresh(Object
entity instance
entity
,
Map<String, Object>
standard and vendor-specific properties
properties
)

Implements jakarta.persistence.EntityManager.refresh.

Refresh the state of the instance from the database, using the specified properties, and overwriting changes made to the entity, if any.
public void
refresh(Object
entity instance
entity
,
LockModeType
lock mode
lockMode
)

Implements jakarta.persistence.EntityManager.refresh.

Refresh the state of the instance from the database, overwriting changes made to the entity, if any, and lock it with respect to given lock mode type.
public void
refresh(Object
entity instance
entity
,
LockModeType
lock mode
lockMode
,
Map<String, Object>
standard and vendor-specific properties and hints
properties
)

Implements jakarta.persistence.EntityManager.refresh.

Refresh the state of the instance from the database, overwriting changes made to the entity, if any, and lock it with respect to given lock mode type.
public void
remove(Object
entity instance
entity
)

Implements jakarta.persistence.EntityManager.remove.

Remove the instance.
public void
removeExtendedPersistenceContext()

Internal method called by EntityTransactionImpl class in case of transaction rollback.

public void
setAbstractSession(AbstractSession session)

INTERNAL: Set the underlying database session

protected void
public void
setFlushMode(FlushModeType
flush mode
flushMode
)

Implements jakarta.persistence.EntityManager.setFlushMode.

Set the flush mode that applies to all objects contained in the persistence context.
protected void
public void
setProperties(Map<K, V> properties)

Use this method to set properties into existing EntityManager that are normally passed to createEntityManager method.

public void
setProperty(String
name of property or hint
propertyName
,
Object
value for property or hint
value
)

Implements jakarta.persistence.EntityManager.setProperty.

Set an entity manager property or hint.
protected void
setRollbackOnly()

Internal method.

public boolean
shouldBeginEarlyTransaction()

Indicate the early transaction should be forced to start.

public boolean
public <T> T

Returns:

an instance of the specified class
unwrap
(Class<T>
the class of the object to be returned. This is normally either the underlying EntityManager implementation class or an interface that it implements.
cls
)

Implements jakarta.persistence.EntityManager.unwrap.

Return an object of the specified type to allow access to the provider-specific API.
public void
public void
verifyOpenWithSetRollbackOnly()

used to save having to constantly use a try/catch to call setRollbackOnly

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait