Package cz.cvut.kbss.jopa.sessions
Class CloningReadOnlyUnitOfWork
java.lang.Object
cz.cvut.kbss.jopa.sessions.AbstractSession
cz.cvut.kbss.jopa.sessions.AbstractUnitOfWork
cz.cvut.kbss.jopa.sessions.CloningReadOnlyUnitOfWork
- All Implemented Interfaces:
ConfigurationHolder,MetamodelProvider,UnitOfWork,Wrapper
Read-only UoW which clones all entities before returning them to the application.
Cloning entities allows using second-level cache which brings better performance than ReadOnlyUnitOfWork
which does not clone entities but also skips second-level cache (unless entity is already there in which case it
behaves exactly like this class).
-
Field Summary
Fields inherited from class cz.cvut.kbss.jopa.sessions.AbstractUnitOfWork
LOGFields inherited from class cz.cvut.kbss.jopa.sessions.AbstractSession
configuration -
Method Summary
Modifier and TypeMethodDescriptionvoidattributeChanged(Object entity, FieldSpecification<?, ?> fieldSpec) Method is not supported.voidattributeChanged(Object entity, Field f) Method is not supported.voidcommit()ReadOnlyUnitOfWorkcommits nothing.voidcreateIndirectCollection(Object collection, Object owner, Field field) Creates an indirect collection that wraps the specified collection instance and propagates changes to this persistence context.protected voidevictAfterMerge(EntityType<?> et, URI identifier, Descriptor descriptor) Method not supported.protected <T> TgetInstanceForMerge(URI identifier, EntityType<T> et, Descriptor descriptor) Method not supported.booleanbooleanReturns true if this Unit of Work is currently flushing changes to the repository.booleanprotected voidmarkCloneForDeletion(Object entity, Object identifier) Method is not supported.<T> TmergeDetached(T entity, Descriptor descriptor) Method not supported.<T> TmergeDetachedInternal(T entity, Descriptor descriptor) Method not supported.protected ObjectChangeSetprocessInferredValueChanges(ObjectChangeSet changeSet) Method is not supported.<T> voidrefreshObject(T object) Method not supported.voidregisterNewObject(Object entity, Descriptor descriptor) Method is not supported.voidregisterOriginalForNewClone(Object clone, Object original) Method is not supported.voidremoveObject(Object object) Method is not supported.voidremoveObjectFromCache(Object toRemove, URI context) Method not supported.voidrestoreRemovedObject(Object entity) Method is not supported.voidMethod is not supported.Methods inherited from class cz.cvut.kbss.jopa.sessions.AbstractUnitOfWork
acquireConnection, begin, clear, contains, copyChangeSet, entityType, getCloneForOriginal, getContexts, getCriteriaBuilder, getFieldDescriptor, getLiveObjectCache, getLoadStateRegistry, getManagedOriginal, getMetamodel, getOriginal, getReference, getState, getState, isActive, isConsistent, isEntityType, isInferred, isInRepository, isInTransaction, isLoaded, isLoaded, isObjectManaged, loadEntityField, putObjectIntoCache, readObject, readObjectFromAxioms, readObjectInternal, readObjectWithoutRegistration, registerExistingObject, registerExistingObject, release, removeIndirectWrappersAndProxies, rollback, sparqlQueryFactory, stringify, unregisterEntityFromOntologyContext, unregisterObject, unwrapMethods inherited from class cz.cvut.kbss.jopa.sessions.AbstractSession
getConfigurationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface cz.cvut.kbss.jopa.sessions.ConfigurationHolder
getConfigurationMethods inherited from interface cz.cvut.kbss.jopa.sessions.MetamodelProvider
getNamedQueryManager, getResultSetMappingManager
-
Method Details
-
commit
public void commit()ReadOnlyUnitOfWorkcommits nothing. The persistence context is cleared.- Specified by:
commitin interfaceUnitOfWork- Overrides:
commitin classAbstractUnitOfWork
-
commitToStorage
public void commitToStorage() -
createIndirectCollection
Description copied from interface:UnitOfWorkCreates an indirect collection that wraps the specified collection instance and propagates changes to this persistence context.- Parameters:
collection- Collection to be proxiedowner- Collection owner instancefield- Field filled with the collection- Returns:
- Indirect collection
-
isReadOnly
public boolean isReadOnly()- Overrides:
isReadOnlyin classAbstractUnitOfWork
-
hasChanges
- Overrides:
hasChangesin classAbstractUnitOfWork- Throws:
UnsupportedOperationException
-
isFlushingChanges
public boolean isFlushingChanges()Description copied from interface:UnitOfWorkReturns true if this Unit of Work is currently flushing changes to the repository.- Specified by:
isFlushingChangesin interfaceUnitOfWork- Overrides:
isFlushingChangesin classAbstractUnitOfWork- Returns:
trueif the UoW is flushing changes,falseotherwise
-
removeObjectFromCache
public void removeObjectFromCache(Object toRemove, URI context) throws UnsupportedOperationException Method not supported.- Specified by:
removeObjectFromCachein interfaceUnitOfWork- Overrides:
removeObjectFromCachein classAbstractUnitOfWork- Parameters:
toRemove- Object to remove from cachecontext- Entity context URI- Throws:
UnsupportedOperationException- Method not supported.
-
mergeDetached
Method not supported.- Specified by:
mergeDetachedin interfaceUnitOfWork- Overrides:
mergeDetachedin classAbstractUnitOfWork- Parameters:
entity- entity instancedescriptor- Entity descriptor, specifies repository context- Returns:
- the managed instance that the state was merged to
- Throws:
UnsupportedOperationException- Method not supported.
-
mergeDetachedInternal
public <T> T mergeDetachedInternal(T entity, Descriptor descriptor) throws UnsupportedOperationException Method not supported.- Throws:
UnsupportedOperationException- Method not supported.
-
getInstanceForMerge
protected <T> T getInstanceForMerge(URI identifier, EntityType<T> et, Descriptor descriptor) throws UnsupportedOperationException Method not supported.- Overrides:
getInstanceForMergein classAbstractUnitOfWork- Throws:
UnsupportedOperationException- Method not supported.
-
evictAfterMerge
protected void evictAfterMerge(EntityType<?> et, URI identifier, Descriptor descriptor) throws UnsupportedOperationException Method not supported.- Overrides:
evictAfterMergein classAbstractUnitOfWork- Throws:
UnsupportedOperationException- Method not supported.
-
refreshObject
Method not supported.- Specified by:
refreshObjectin interfaceUnitOfWork- Overrides:
refreshObjectin classAbstractUnitOfWork- Type Parameters:
T- Object type- Parameters:
object- The object to revert- Throws:
UnsupportedOperationException- Method not supported.
-
processInferredValueChanges
protected ObjectChangeSet processInferredValueChanges(ObjectChangeSet changeSet) throws UnsupportedOperationException Method is not supported.- Overrides:
processInferredValueChangesin classAbstractUnitOfWork- Throws:
UnsupportedOperationException- Always thrown
-
registerOriginalForNewClone
public void registerOriginalForNewClone(Object clone, Object original) throws UnsupportedOperationException Method is not supported.- Overrides:
registerOriginalForNewClonein classAbstractUnitOfWork- Parameters:
clone- Already registered cloneoriginal- Original to register- Throws:
UnsupportedOperationException- Always thrown
-
writeUncommittedChanges
Method is not supported.- Specified by:
writeUncommittedChangesin interfaceUnitOfWork- Overrides:
writeUncommittedChangesin classAbstractUnitOfWork- Throws:
UnsupportedOperationException- Always thrown
-
restoreRemovedObject
Method is not supported.- Specified by:
restoreRemovedObjectin interfaceUnitOfWork- Overrides:
restoreRemovedObjectin classAbstractUnitOfWork- Parameters:
entity- The object to restore- Throws:
UnsupportedOperationException- Always thrown
-
attributeChanged
Method is not supported.- Parameters:
entity- Entity with changes (the clone)f- The field whose value has changed- Throws:
UnsupportedOperationException- Always thrown- See Also:
-
attributeChanged
public void attributeChanged(Object entity, FieldSpecification<?, ?> fieldSpec) throws UnsupportedOperationExceptionMethod is not supported.- Parameters:
entity- Entity with changes (the clone)fieldSpec- Metamodel element representing the attribute that changed- Throws:
UnsupportedOperationException- Always thrown
-
markCloneForDeletion
protected void markCloneForDeletion(Object entity, Object identifier) throws UnsupportedOperationException Method is not supported.- Overrides:
markCloneForDeletionin classAbstractUnitOfWork- Throws:
UnsupportedOperationException- Always thrown
-
registerNewObject
public void registerNewObject(Object entity, Descriptor descriptor) throws UnsupportedOperationException Method is not supported.- Specified by:
registerNewObjectin interfaceUnitOfWork- Overrides:
registerNewObjectin classAbstractUnitOfWork- Parameters:
entity- The object to registerdescriptor- Entity descriptor- Throws:
UnsupportedOperationException- Always thrown
-
removeObject
Method is not supported.- Parameters:
object- Object to remove- Throws:
UnsupportedOperationException- Always thrown
-