Class PersistenceManagerImpl
- java.lang.Object
-
- com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl
-
- All Implemented Interfaces:
PersistenceManager
,PersistenceManager
public class PersistenceManagerImpl extends Object implements PersistenceManager
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acquireCacheLock()
Lock cache for getObjectById and result processing synchronization.void
acquireExclusiveLock()
Acquires an exclusive lock from the persistence manager.void
acquireFieldUpdateLock()
Acquire lock for synchronizing field updates.void
acquireShareLock()
Acquires a share lock from the persistence manager.void
afterCompletion(int status)
Called by Transaction commit() or rollback() cleans up transactional cachevoid
beforeCompletion()
Called by Transaction commit().void
clearFields(Object pc)
void
close()
close the persistence managerTransaction
currentTransaction()
Returns transaction associated with this persistence managervoid
deletePersistent(Object pc)
Delete the persistent instance from the data store.void
deletePersistent(Object[] pcs)
Delete an array of instances from the data store.void
deletePersistent(Collection pcs)
Delete a Collection of instances from the data store.void
deregisterInstance(Object oid)
Deregister an instance.void
deregisterInstance(Object oid, StateManager sm)
Deregister an instance with this object Id, only if it holds the same instance.StateManager
findOrCreateStateManager(Object oid, Class pcClass)
Called internally byRetrieveDesc
to lookup an instance in the cache, or prepare new instance to be populated with values from the datastore.void
forceClose()
Force to close the persistence manager.PersistenceManagerWrapper
getCurrentWrapper()
Collection
getExtent(Class persistenceCapableClass, boolean subclasses)
The PersistenceManager may manage a collection of instances in the data store based on the class of the instances.Object
getField(Object pc, int fieldNumber)
byte
getFlags(Object pc)
protected boolean
getIgnoreCache()
Object
getObjectById(Object oid)
This method locates a persistent instance in the cache of instances managed by this PersistenceManager.Object
getObjectById(Object oid, boolean validate)
This method locates a persistent instance in the cache of instances managed by thisPersistenceManager
.Object
getObjectId(Object pc)
The ObjectId returned by this method represents the JDO identity of the instance.Class
getObjectIdClass(Class cls)
In order for the application to construct instance of the ObjectId class it needs to know the class being used by the JDO implementation.PersistenceManagerFactory
getPersistenceManagerFactory()
This method returns the PersistenceManagerFactory used to create this PersistenceManager.Properties
getProperties()
The JDO vendor might store certain non-operational properties and make those properties available to applications (for troubleshooting).boolean
getRequireCopyObjectId()
Returns the boolean value of the requireCopyObjectId flag for this PersistenceManager.boolean
getRequireTrackedSCO()
Returns the boolean value of the requireTrackedSCO flag for this PersistenceManager.RetrieveDesc
getRetrieveDesc(Class classType)
Return a RetrieveDesc given a Class object.RetrieveDesc
getRetrieveDesc(String fieldName, Class classType)
Return a RetrieveDesc for a foreign field (relationship) given the Class object for the parent class.StateManager
getStateManager(Object pc)
protected PersistenceStore
getStore()
boolean
getSupersedeDeletedInstance()
Returns the boolean value of the supersedeDeletedInstance flag for this PersistenceManager.Object
getTransactionalInstance(Object pc)
This method is used to get a PersistenceCapable instance representing the same data store object as the parameter, that is valid for this PersistenceManager.Object
getUserObject()
The application can manage the PersistenceManager instances more easily by having an application object associated with each PersistenceManager instance.boolean
initializeFromVersionConsistencyCache(StateManager sm)
Looks up the given instance in the Version Consistency cache and if found, populates it from the cached values.void
internalFlush()
Called by Query to flush updates to the database in pessimistic transaction.boolean
isActiveTransaction()
Returns true if associated transaction is activeboolean
isClosed()
A PersistenceManager instance can be used until it is closed.boolean
isNontransactionalRead()
Returns true if associated transaction is optimisticboolean
isOptimisticTransaction()
Returns true if associated transaction is optimisticvoid
makePersistent(Object pc)
Make the transient instance persistent in this PersistenceManager.void
makePersistent(Object[] pcs)
Make an array of instances persistent.void
makePersistent(Collection pcs)
Make a Collection of instances persistent.Object
newCollectionInstance(Class type, Object owner, String fieldName, Class elementType, boolean allowNulls, int initialSize)
Returns a new Collection instance of the type specified, with the owner and field name to notify upon changes to the value of any of its fields.Object
newCollectionInstanceInternal(Class type, Object owner, String fieldName, Class elementType, boolean allowNulls, int initialSize)
Called by newCollectionInstance from the public interface or internally by the runtime Will not result in marking field as dirtyObject
newInstance(StateManager sm)
Returns a new instance of the object defined by the given StateManagerQuery
newQuery()
Create a new Query with no elements.Query
newQuery(Class cls)
Create a new Query specifying the Class of the results.Query
newQuery(Class cls, String filter)
Create a new Query with the Class of the results and Filter.Query
newQuery(Class cls, Collection cln)
Create a new Query with the Class of the results and candidate Collection.Query
newQuery(Class cls, Collection cln, String filter)
Create a new Query with the Class of the results, candidate Collection, and Filter.Query
newQuery(Object compiled)
Create a new Query using elements from another Query.Object
newSCOInstance(Class type, Object owner, String fieldName)
Returns a new Second Class Object instance of the type specified, with the owner and field name to notify upon changes to the value of any of its fields.Object
newSCOInstanceInternal(Class type, Object owner, String fieldName)
Called by newSCOInstance from the public interface or internally by the runtime Will not result in marking field as dirty Returns a new Second Class Object instance of the type specified,void
notifyNontransactionalRead(boolean nontransactionalRead)
For Transaction to notify PersistenceManager that nontransactionalRead flag is changedvoid
notifyOptimistic(boolean optimistic)
For Transaction to notify PersistenceManager that optimistic flag is changedvoid
notifyStatusChange(boolean isActive)
For Transaction to notify PersistenceManager that status is changedprotected void
popCurrentWrapper(PersistenceManagerWrapper prev)
protected void
pushCurrentWrapper(PersistenceManagerWrapper pmw)
void
registerInstance(StateManager sm, Object oid)
Register instance in the weak cache only.void
registerInstance(StateManager sm, Object oid, boolean throwDuplicateException, boolean forceRegister)
Register instance in the transactional cachevoid
releaseCacheLock()
Release cache lock.void
releaseExclusiveLock()
Release the exclusive lock and notify any thread waiting to get an exclusive or share lock.void
releaseFieldUpdateLock()
Release lock for synchronizing field updates.void
releaseShareLock()
Releases the share lock and notify any thread waiting to get an exclusive lock.Object
retrieve(RetrieveDesc action)
Executes the given retrieve descriptor.Object
retrieve(RetrieveDesc action, ValueFetcher parameters)
Executes the given retrieve descriptor.void
setField(Object o, int fieldNumber, Object value)
void
setFlags(Object pc, byte flags)
protected void
setJTATransaction(jakarta.transaction.Transaction t)
Assigns reference to jakarta.transaction.Transaction associated with the current thread in the managed environmentvoid
setRequireCopyObjectId(boolean flag)
Sets the requireCopyObjectId flag for this PersistenceManager.void
setRequireTrackedSCO(boolean flag)
Sets the requireTrackedSCO flag for this PersistenceManager.void
setStateManager(Object pc, StateManager sm)
protected void
setStore(PersistenceStore store)
void
setSupersedeDeletedInstance(boolean flag)
Sets the supersedeDeletedInstance flag for this PersistenceManager.void
setUserObject(Object o)
The application can manage the PersistenceManager instances more easily by having an application object associated with each PersistenceManager instance.protected boolean
verify(String username, char[] password)
-
-
-
Method Detail
-
setStore
protected void setStore(PersistenceStore store)
-
getStore
protected PersistenceStore getStore()
-
getIgnoreCache
protected boolean getIgnoreCache()
-
verify
protected boolean verify(String username, char[] password)
-
isClosed
public boolean isClosed()
Description copied from interface:PersistenceManager
A PersistenceManager instance can be used until it is closed.- Specified by:
isClosed
in interfacePersistenceManager
- Returns:
- if this PersistenceManager has been closed
- See Also:
PersistenceManager.close()
-
forceClose
public void forceClose()
Force to close the persistence manager. Called by TransactionImpl.afterCompletion in case of the CMT transaction and the status value passed to the method cannot be resolved.- Specified by:
forceClose
in interfacePersistenceManager
-
close
public void close()
close the persistence manager- Specified by:
close
in interfacePersistenceManager
-
currentTransaction
public Transaction currentTransaction()
Returns transaction associated with this persistence manager- Specified by:
currentTransaction
in interfacePersistenceManager
- Returns:
- transaction current transaction
-
newQuery
public Query newQuery()
Create a new Query with no elements.- Specified by:
newQuery
in interfacePersistenceManager
- Returns:
- a new Query instance with no elements.
-
newQuery
public Query newQuery(Object compiled)
Create a new Query using elements from another Query. The other Query must have been created by the same JDO implementation. It might be active in a different PersistenceManager or might have been serialized and restored.- Specified by:
newQuery
in interfacePersistenceManager
- Parameters:
compiled
- another Query from the same JDO implementation- Returns:
- the new Query
-
newQuery
public Query newQuery(Class cls)
Create a new Query specifying the Class of the results.- Specified by:
newQuery
in interfacePersistenceManager
- Parameters:
cls
- the Class of the results- Returns:
- the new Query
-
newQuery
public Query newQuery(Class cls, Collection cln)
Create a new Query with the Class of the results and candidate Collection. specified.- Specified by:
newQuery
in interfacePersistenceManager
- Parameters:
cls
- the Class of resultscln
- the Collection of candidate instances- Returns:
- the new Query
-
newQuery
public Query newQuery(Class cls, String filter)
Create a new Query with the Class of the results and Filter. specified.- Specified by:
newQuery
in interfacePersistenceManager
- Parameters:
cls
- the Class of resultsfilter
- the Filter for candidate instances- Returns:
- the new Query
-
newQuery
public Query newQuery(Class cls, Collection cln, String filter)
Create a new Query with the Class of the results, candidate Collection, and Filter.- Specified by:
newQuery
in interfacePersistenceManager
- Parameters:
cls
- the Class of resultscln
- the Collection of candidate instancesfilter
- the Filter for candidate instances- Returns:
- the new Query
-
getExtent
public Collection getExtent(Class persistenceCapableClass, boolean subclasses)
The PersistenceManager may manage a collection of instances in the data store based on the class of the instances. This method returns a Collection of instances in the data store that might be iterated or given to a Query as the Collection of candidate instances.- Specified by:
getExtent
in interfacePersistenceManager
- Parameters:
persistenceCapableClass
- Class of instancessubclasses
- whether to include instances of subclasses- Returns:
- a Collection of instances
- See Also:
newQuery()
-
getObjectById
public Object getObjectById(Object oid)
This method locates a persistent instance in the cache of instances managed by this PersistenceManager. If an instance with the same ObjectId is found it is returned. Otherwise, a new instance is created and associated with the ObjectId.If the instance does not exist in the data store, then this method will not fail. However, a request to access fields of the instance will throw an exception.
- Specified by:
getObjectById
in interfacePersistenceManager
- Parameters:
oid
- an ObjectId- Returns:
- the PersistenceCapable instance with the specified ObjectId
- See Also:
getObjectById(Object, boolean)
-
getObjectById
public Object getObjectById(Object oid, boolean validate)
This method locates a persistent instance in the cache of instances managed by thisPersistenceManager
. ThegetObjectByIdInternal
method attempts to find an instance in the cache with the specified JDO identity.If the
PersistenceManager
is unable to resolve theoid
parameter to an ObjectId instance, then it throws aJDOUserException
.If the
validate
flag isfalse
, and there is already an instance in the cache with the same JDO identity as theoid
parameter, then this method returns it. There is no change made to the state of the returned instance.If there is not an instance already in the cache with the same JDO identity as the
oid
parameter, then this method creates an instance with the specified JDO identity and returns it. If there is no transaction in progress, the returned instance will be hollow.If there is a transaction in progress, the returned instance will persistent-nontransactional in an optimistic transaction, or persistent-clean in a datastore transaction.
- Specified by:
getObjectById
in interfacePersistenceManager
- Parameters:
oid
- an ObjectIdvalidate
- if the existence of the instance is to be validated- Returns:
- the
PersistenceCapable
instance with the specified ObjectId - See Also:
PersistenceManager.getObjectId(Object pc)
,PersistenceManager.getObjectById(Object oid)
-
findOrCreateStateManager
public StateManager findOrCreateStateManager(Object oid, Class pcClass)
Called internally byRetrieveDesc
to lookup an instance in the cache, or prepare new instance to be populated with values from the datastore.- Specified by:
findOrCreateStateManager
in interfacePersistenceManager
- Parameters:
oid
- an ObjectIdpcClass
- the Class type of the PersistenceCapable instance to be associated with this StateManager.- Returns:
- the
StateManager
instance with the specified ObjectId
-
getObjectId
public Object getObjectId(Object pc)
The ObjectId returned by this method represents the JDO identity of the instance. The ObjectId is a copy (clone) of the internal state of the instance, and changing it does not affect the JDO identity of the instance. Delegates actual execution to the internal method.- Specified by:
getObjectId
in interfacePersistenceManager
- Parameters:
pc
- the PersistenceCapable instance- Returns:
- the ObjectId of the instance
-
getTransactionalInstance
public Object getTransactionalInstance(Object pc)
This method is used to get a PersistenceCapable instance representing the same data store object as the parameter, that is valid for this PersistenceManager.- Specified by:
getTransactionalInstance
in interfacePersistenceManager
- Parameters:
pc
- a PersistenceCapable instance- Returns:
- the PersistenceCapable instance representing the same data store object
-
makePersistent
public void makePersistent(Object pc)
Make the transient instance persistent in this PersistenceManager. This method must be called in an active transaction. The PersistenceManager assigns an ObjectId to the instance and transitions it to persistent-new. The instance will be managed in the Extent associated with its Class. The instance will be put into the data store at commit.- Specified by:
makePersistent
in interfacePersistenceManager
- Parameters:
pc
- a transient instance of a Class that implements PersistenceCapable
-
makePersistent
public void makePersistent(Object[] pcs)
Make an array of instances persistent.- Specified by:
makePersistent
in interfacePersistenceManager
- Parameters:
pcs
- an array of transient instances- See Also:
makePersistent(Object pc)
-
makePersistent
public void makePersistent(Collection pcs)
Description copied from interface:PersistenceManager
Make a Collection of instances persistent.- Specified by:
makePersistent
in interfacePersistenceManager
- Parameters:
pcs
- a Collection of transient instances- See Also:
PersistenceManager.makePersistent(Object pc)
-
deletePersistent
public void deletePersistent(Object pc)
Description copied from interface:PersistenceManager
Delete the persistent instance from the data store. This method must be called in an active transaction. The data store object will be removed at commit. Unlike makePersistent, which makes the closure of the instance persistent, the closure of the instance is not deleted from the data store. This method has no effect if the instance is already deleted in the current transaction. This method throws an exception if the instance is transient or is managed by another PersistenceManager.- Specified by:
deletePersistent
in interfacePersistenceManager
- Parameters:
pc
- a persistent instance
-
deletePersistent
public void deletePersistent(Object[] pcs)
Description copied from interface:PersistenceManager
Delete an array of instances from the data store.- Specified by:
deletePersistent
in interfacePersistenceManager
- Parameters:
pcs
- a Collection of persistent instances- See Also:
PersistenceManager.deletePersistent(Object pc)
-
deletePersistent
public void deletePersistent(Collection pcs)
Description copied from interface:PersistenceManager
Delete a Collection of instances from the data store.- Specified by:
deletePersistent
in interfacePersistenceManager
- Parameters:
pcs
- a Collection of persistent instances- See Also:
PersistenceManager.deletePersistent(Object pc)
-
getPersistenceManagerFactory
public PersistenceManagerFactory getPersistenceManagerFactory()
This method returns the PersistenceManagerFactory used to create this PersistenceManager. It returns null if this instance was created via a constructor.- Specified by:
getPersistenceManagerFactory
in interfacePersistenceManager
- Returns:
- the PersistenceManagerFactory that created this PersistenceManager
-
setUserObject
public void setUserObject(Object o)
The application can manage the PersistenceManager instances more easily by having an application object associated with each PersistenceManager instance.- Specified by:
setUserObject
in interfacePersistenceManager
- Parameters:
o
- the user instance to be remembered by the PersistenceManager- See Also:
getUserObject()
-
getUserObject
public Object getUserObject()
The application can manage the PersistenceManager instances more easily by having an application object associated with each PersistenceManager instance.- Specified by:
getUserObject
in interfacePersistenceManager
- Returns:
- the user object associated with this PersistenceManager
- See Also:
setUserObject(java.lang.Object)
-
getProperties
public Properties getProperties()
The JDO vendor might store certain non-operational properties and make those properties available to applications (for troubleshooting).Standard properties include:
- VendorName
- VersionNumber
- Specified by:
getProperties
in interfacePersistenceManager
- Returns:
- the Properties of this PersistenceManager
-
getSupersedeDeletedInstance
public boolean getSupersedeDeletedInstance()
Returns the boolean value of the supersedeDeletedInstance flag for this PersistenceManager. If set to true, deleted instances are allowed to be replaced with persistent-new instances with the equal Object Id.- Specified by:
getSupersedeDeletedInstance
in interfacePersistenceManager
- Returns:
- boolean supersedeDeletedInstance flag
-
setSupersedeDeletedInstance
public void setSupersedeDeletedInstance(boolean flag)
Sets the supersedeDeletedInstance flag for this PersistenceManager.- Specified by:
setSupersedeDeletedInstance
in interfacePersistenceManager
- Parameters:
flag
- boolean supersedeDeletedInstance flag
-
getRequireCopyObjectId
public boolean getRequireCopyObjectId()
Returns the boolean value of the requireCopyObjectId flag for this PersistenceManager. If set to false, the PersistenceManager does not create a copy of an ObjectId forPersistenceManager.getObjectId(Object pc)
andPersistenceManager.getObjectById(Object oid)
requests.- Specified by:
getRequireCopyObjectId
in interfacePersistenceManager
- Returns:
- boolean requireCopyObjectId flag
- See Also:
PersistenceManager.getObjectId(Object pc)
,PersistenceManager.getObjectById(Object oid)
-
setRequireCopyObjectId
public void setRequireCopyObjectId(boolean flag)
Sets the requireCopyObjectId flag for this PersistenceManager. If set to false, the PersistenceManager will not create a copy of an ObjectId forPersistenceManager.getObjectId(Object pc)
andPersistenceManager.getObjectById(Object oid)
requests.- Specified by:
setRequireCopyObjectId
in interfacePersistenceManager
- Parameters:
flag
- boolean requireCopyObjectId flag- See Also:
PersistenceManager.getObjectId(Object pc)
,PersistenceManager.getObjectById(Object oid)
-
getRequireTrackedSCO
public boolean getRequireTrackedSCO()
Returns the boolean value of the requireTrackedSCO flag for this PersistenceManager. If set to false, this PersistenceManager will not create tracked SCO instances for new persistent instances at commit with retainValues set to true and while retrieving data from a datastore.- Specified by:
getRequireTrackedSCO
in interfacePersistenceManager
- Returns:
- boolean requireTrackedSCO flag
-
setRequireTrackedSCO
public void setRequireTrackedSCO(boolean flag)
Sets the requireTrackedSCO flag for this PersistenceManager. If set to false, this PersistenceManager will not create tracked SCO instances for new persistent instances at commit with retainValues set to true and while retrieving data from a datastore.- Specified by:
setRequireTrackedSCO
in interfacePersistenceManager
- Parameters:
flag
- boolean requireTrackedSCO flag
-
getObjectIdClass
public Class getObjectIdClass(Class cls)
In order for the application to construct instance of the ObjectId class it needs to know the class being used by the JDO implementation.- Specified by:
getObjectIdClass
in interfacePersistenceManager
- Parameters:
cls
- the PersistenceCapable Class- Returns:
- the Class of the ObjectId of the parameter
-
newInstance
public Object newInstance(StateManager sm)
Returns a new instance of the object defined by the given StateManager- Specified by:
newInstance
in interfacePersistenceManager
- Parameters:
sm
- StateManager- Returns:
- new instance of the object
-
retrieve
public Object retrieve(RetrieveDesc action, ValueFetcher parameters)
Executes the given retrieve descriptor. The result is a collection unless an aggregate query was specified. In most cases the query result is a collection of persistent objects. In case of a projection on a local field the collection holds objects of that type. For aggregate queries the result is a single object, which type was defined by the caller.- Specified by:
retrieve
in interfacePersistenceManager
- Parameters:
action
- The retrieve descriptor.parameters
- The input parameters for the query.- Returns:
- A collection of (persistent) objects unless an aggregate query was specified.
-
retrieve
public Object retrieve(RetrieveDesc action)
Executes the given retrieve descriptor. The result is a collection unless an aggregate query was specified. In most cases the query result is a collection of persistent objects. In case of a projection on a local field the collection holds objects of that type. For aggregate queries the result is a single object, which type was defined by the caller.- Specified by:
retrieve
in interfacePersistenceManager
- Parameters:
action
- The retrieve descriptor.- Returns:
- A collection of (persistent) objects unless an aggregate query was specified.
-
getRetrieveDesc
public RetrieveDesc getRetrieveDesc(Class classType)
Return a RetrieveDesc given a Class object.- Specified by:
getRetrieveDesc
in interfacePersistenceManager
-
getRetrieveDesc
public RetrieveDesc getRetrieveDesc(String fieldName, Class classType)
Return a RetrieveDesc for a foreign field (relationship) given the Class object for the parent class.- Specified by:
getRetrieveDesc
in interfacePersistenceManager
-
registerInstance
public void registerInstance(StateManager sm, Object oid)
Register instance in the weak cache only. Used to restore persistent instance at the rollback if it was replaced during transaction execution with another instance with the same object Id.- Specified by:
registerInstance
in interfacePersistenceManager
-
registerInstance
public void registerInstance(StateManager sm, Object oid, boolean throwDuplicateException, boolean forceRegister)
Register instance in the transactional cache- Specified by:
registerInstance
in interfacePersistenceManager
-
deregisterInstance
public void deregisterInstance(Object oid)
Description copied from interface:PersistenceManager
Deregister an instance.- Specified by:
deregisterInstance
in interfacePersistenceManager
-
deregisterInstance
public void deregisterInstance(Object oid, StateManager sm)
Description copied from interface:PersistenceManager
Deregister an instance with this object Id, only if it holds the same instance.- Specified by:
deregisterInstance
in interfacePersistenceManager
-
beforeCompletion
public void beforeCompletion()
Called by Transaction commit(). Flushes dirty instances to the store. Clean instances registered for Version Consistency are verified with the store.- Specified by:
beforeCompletion
in interfacePersistenceManager
-
afterCompletion
public void afterCompletion(int status)
Called by Transaction commit() or rollback() cleans up transactional cache- Specified by:
afterCompletion
in interfacePersistenceManager
- Parameters:
status
- jakarta.transaction.Status
-
initializeFromVersionConsistencyCache
public boolean initializeFromVersionConsistencyCache(StateManager sm)
Description copied from interface:PersistenceManager
Looks up the given instance in the Version Consistency cache and if found, populates it from the cached values.- Specified by:
initializeFromVersionConsistencyCache
in interfacePersistenceManager
- Parameters:
sm
- Instance to be looked up in the version consistency cache. If found, it is populated with values from the cache.- Returns:
- true if the
sm
was found and populated, false otherwise.
-
setStateManager
public void setStateManager(Object pc, StateManager sm)
- Specified by:
setStateManager
in interfacePersistenceManager
-
setFlags
public void setFlags(Object pc, byte flags)
- Specified by:
setFlags
in interfacePersistenceManager
-
getFlags
public byte getFlags(Object pc)
- Specified by:
getFlags
in interfacePersistenceManager
-
getStateManager
public StateManager getStateManager(Object pc)
- Specified by:
getStateManager
in interfacePersistenceManager
-
setField
public void setField(Object o, int fieldNumber, Object value)
- Specified by:
setField
in interfacePersistenceManager
-
getField
public Object getField(Object pc, int fieldNumber)
- Specified by:
getField
in interfacePersistenceManager
-
clearFields
public void clearFields(Object pc)
- Specified by:
clearFields
in interfacePersistenceManager
-
newSCOInstance
public Object newSCOInstance(Class type, Object owner, String fieldName)
Returns a new Second Class Object instance of the type specified, with the owner and field name to notify upon changes to the value of any of its fields. If a collection class is created, then the class does not restrict the element types, and allows nulls to be added as elements.- Specified by:
newSCOInstance
in interfacePersistenceManager
- Parameters:
type
- Class of the new SCO instanceowner
- the owner to notify upon changesfieldName
- the field to notify upon changes- Returns:
- the object of the class type
-
newSCOInstanceInternal
public Object newSCOInstanceInternal(Class type, Object owner, String fieldName)
Called by newSCOInstance from the public interface or internally by the runtime Will not result in marking field as dirty Returns a new Second Class Object instance of the type specified,- Specified by:
newSCOInstanceInternal
in interfacePersistenceManager
- Parameters:
type
- Class of the new SCO instanceowner
- the owner to notify upon changesfieldName
- the field to notify upon changes- Returns:
- the object of the class type
-
newCollectionInstance
public Object newCollectionInstance(Class type, Object owner, String fieldName, Class elementType, boolean allowNulls, int initialSize)
Returns a new Collection instance of the type specified, with the owner and field name to notify upon changes to the value of any of its fields. The collection class restricts the element types allowed to the elementType or instances assignable to the elementType, and allows nulls to be added as elements based on the setting of allowNulls. The Collection has an initial size as specified by the initialSize parameter. We choose to use HashSet as a default collection (no specific type is chosen) because we do not support duplicate objects in DB- Specified by:
newCollectionInstance
in interfacePersistenceManager
- Parameters:
type
- Class of the new SCO instanceowner
- the owner to notify upon changesfieldName
- the field to notify upon changeselementType
- the element types allowedallowNulls
- true if allowedinitialSize
- initial size of the Collection- Returns:
- the object of the class type
-
newCollectionInstanceInternal
public Object newCollectionInstanceInternal(Class type, Object owner, String fieldName, Class elementType, boolean allowNulls, int initialSize)
Called by newCollectionInstance from the public interface or internally by the runtime Will not result in marking field as dirty- Specified by:
newCollectionInstanceInternal
in interfacePersistenceManager
- Parameters:
type
- Class of the new SCO instanceowner
- the owner to notify upon changesfieldName
- the field to notify upon changeselementType
- the element types allowedallowNulls
- true if allowedinitialSize
- initial size of the Collection- Returns:
- the object of the class type
- See Also:
for more information
-
internalFlush
public void internalFlush()
Called by Query to flush updates to the database in pessimistic transaction. Calls internaly beforeCompletion() to do actual flush- Specified by:
internalFlush
in interfacePersistenceManager
- See Also:
beforeCompletion()
-
notifyStatusChange
public void notifyStatusChange(boolean isActive)
For Transaction to notify PersistenceManager that status is changed- Specified by:
notifyStatusChange
in interfacePersistenceManager
-
notifyOptimistic
public void notifyOptimistic(boolean optimistic)
For Transaction to notify PersistenceManager that optimistic flag is changed- Specified by:
notifyOptimistic
in interfacePersistenceManager
-
isOptimisticTransaction
public boolean isOptimisticTransaction()
Returns true if associated transaction is optimistic- Specified by:
isOptimisticTransaction
in interfacePersistenceManager
-
notifyNontransactionalRead
public void notifyNontransactionalRead(boolean nontransactionalRead)
For Transaction to notify PersistenceManager that nontransactionalRead flag is changed- Specified by:
notifyNontransactionalRead
in interfacePersistenceManager
-
isNontransactionalRead
public boolean isNontransactionalRead()
Returns true if associated transaction is optimistic- Specified by:
isNontransactionalRead
in interfacePersistenceManager
-
isActiveTransaction
public boolean isActiveTransaction()
Returns true if associated transaction is active- Specified by:
isActiveTransaction
in interfacePersistenceManager
-
getCurrentWrapper
public PersistenceManagerWrapper getCurrentWrapper()
- Specified by:
getCurrentWrapper
in interfacePersistenceManager
-
pushCurrentWrapper
protected void pushCurrentWrapper(PersistenceManagerWrapper pmw)
-
popCurrentWrapper
protected void popCurrentWrapper(PersistenceManagerWrapper prev)
-
setJTATransaction
protected void setJTATransaction(jakarta.transaction.Transaction t)
Assigns reference to jakarta.transaction.Transaction associated with the current thread in the managed environment
-
acquireShareLock
public void acquireShareLock()
Acquires a share lock from the persistence manager. This method will put the calling thread to sleep if another thread is holding the exclusive lock.- Specified by:
acquireShareLock
in interfacePersistenceManager
-
releaseShareLock
public void releaseShareLock()
Releases the share lock and notify any thread waiting to get an exclusive lock. Note that every releaseShareLock() call needs to be preceeded by an acquireShareLock() call.- Specified by:
releaseShareLock
in interfacePersistenceManager
-
acquireExclusiveLock
public void acquireExclusiveLock()
Acquires an exclusive lock from the persistence manager. By acquiring an exclusive lock, a thread is guaranteed to have exclusive right to the persistence runtime meaning no other threads can perform any operation in the sqlstore. NOTE: This implementation does not detect if a thread holding a share lock attempts to acquire an exclusive lock. It is up to the callers to make sure this does not happen.- Specified by:
acquireExclusiveLock
in interfacePersistenceManager
-
releaseExclusiveLock
public void releaseExclusiveLock()
Release the exclusive lock and notify any thread waiting to get an exclusive or share lock. Note that every releaseShareLock() call needs to be preceeded by an acquireExclusiveLock() call.- Specified by:
releaseExclusiveLock
in interfacePersistenceManager
-
acquireFieldUpdateLock
public void acquireFieldUpdateLock()
Acquire lock for synchronizing field updates.- Specified by:
acquireFieldUpdateLock
in interfacePersistenceManager
-
releaseFieldUpdateLock
public void releaseFieldUpdateLock()
Release lock for synchronizing field updates.- Specified by:
releaseFieldUpdateLock
in interfacePersistenceManager
-
acquireCacheLock
public void acquireCacheLock()
Lock cache for getObjectById and result processing synchronization.- Specified by:
acquireCacheLock
in interfacePersistenceManager
-
releaseCacheLock
public void releaseCacheLock()
Release cache lock.- Specified by:
releaseCacheLock
in interfacePersistenceManager
-
-