/** * INTERNAL * Return true if the refresh should refresh on this mapping or not. */ protected ReadObjectQuery buildCascadeQuery(MergeManager mergeManager) { ReadObjectQuery cascadeQuery = new ReadObjectQuery(); if (mergeManager.shouldCascadeAllParts()) { cascadeQuery.cascadeAllParts(); cascadeQuery.refreshIdentityMapResult(); } if (mergeManager.shouldCascadePrivateParts() && getForeignReferenceMapping().isPrivateOwned()) { cascadeQuery.cascadePrivateParts(); cascadeQuery.refreshIdentityMapResult(); } return cascadeQuery; }
/** * INTERNAL: * Check if the object is invalid and refresh it. * This is used to ensure that no invalid objects are registered. */ public void checkAndRefreshInvalidObject(Object object, CacheKey cacheKey, ClassDescriptor descriptor) { if (isConsideredInvalid(object, cacheKey, descriptor)) { ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(object.getClass()); query.setSelectionId(cacheKey.getKey()); query.refreshIdentityMapResult(); query.setIsExecutionClone(true); this.executeQuery(query); } }
/** * INTERNAL * Return true if the refresh should refresh on this mapping or not. */ protected ReadObjectQuery buildCascadeQuery(MergeManager mergeManager) { ReadObjectQuery query = new ReadObjectQuery(); if (this.mapping.getReferenceDescriptor() != null) { query.setReferenceClass(this.mapping.getReferenceDescriptor().getJavaClass()); } if (mergeManager.shouldCascadeAllParts()) { query.cascadeAllParts(); query.refreshIdentityMapResult(); } if (mergeManager.shouldCascadePrivateParts() && getForeignReferenceMapping().isPrivateOwned()) { query.cascadePrivateParts(); query.refreshIdentityMapResult(); } return query; }
/** * INTERNAL * Return true if the refresh should refresh on this mapping or not. */ protected ReadObjectQuery buildCascadeQuery(MergeManager mergeManager) { ReadObjectQuery query = new ReadObjectQuery(); if (this.mapping.getReferenceDescriptor() != null) { query.setReferenceClass(this.mapping.getReferenceDescriptor().getJavaClass()); } if (mergeManager.shouldCascadeAllParts()) { query.cascadeAllParts(); query.refreshIdentityMapResult(); } if (mergeManager.shouldCascadePrivateParts() && getForeignReferenceMapping().isPrivateOwned()) { query.cascadePrivateParts(); query.refreshIdentityMapResult(); } return query; }
/** * PUBLIC: * Refresh the attributes of the object and of all of its private parts from the database. * The object will be pessimisticly locked on the database for the duration of the transaction. * <p>Lock Modes: ObjectBuildingQuery.NO_LOCK, LOCK, LOCK_NOWAIT */ public Object refreshAndLockObject(Object object, short lockMode) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setSelectionObject(object); query.refreshIdentityMapResult(); query.cascadePrivateParts(); query.setLockMode(lockMode); query.setIsExecutionClone(true); return executeQuery(query); }
/** * PUBLIC: * Refresh the attributes of the object and of all of its private parts from the database. * The object will be pessimisticly locked on the database for the duration of the transaction. * <p>Lock Modes: ObjectBuildingQuery.NO_LOCK, LOCK, LOCK_NOWAIT */ public Object refreshAndLockObject(Object object, short lockMode) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setSelectionObject(object); query.refreshIdentityMapResult(); query.cascadePrivateParts(); query.setLockMode(lockMode); query.setIsExecutionClone(true); return executeQuery(query); }
/** * PUBLIC: * Refresh the attributes of the object and of all of its private parts from the database. * The object will be pessimisticly locked on the database for the duration of the transaction. * <p>Lock Modes: ObjectBuildingQuery.NO_LOCK, LOCK, LOCK_NOWAIT */ public Object refreshAndLockObject(Object object, short lockMode) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setSelectionObject(object); query.refreshIdentityMapResult(); query.cascadePrivateParts(); query.setLockMode(lockMode); query.setIsExecutionClone(true); return executeQuery(query); }
/** * INTERNAL: * Check if the object is invalid and refresh it. * This is used to ensure that no invalid objects are registered. */ public void checkAndRefreshInvalidObject(Object object, CacheKey cacheKey, ClassDescriptor descriptor) { if (isConsideredInvalid(object, cacheKey, descriptor)) { // cuba begin: always load refreshed object Boolean prevSoftDeletion = org.eclipse.persistence.internal.helper.CubaUtil.setSoftDeletion(false); try { ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(object.getClass()); query.setSelectionId(cacheKey.getKey()); query.refreshIdentityMapResult(); query.setIsExecutionClone(true); this.executeQuery(query); } finally { org.eclipse.persistence.internal.helper.CubaUtil.setSoftDeletion(prevSoftDeletion); } // ReadObjectQuery query = new ReadObjectQuery(); // query.setReferenceClass(object.getClass()); // query.setSelectionId(cacheKey.getKey()); // query.refreshIdentityMapResult(); // query.setIsExecutionClone(true); // this.executeQuery(query); // cuba end } }
/** * INTERNAL: * Check if the object is invalid and refresh it. * This is used to ensure that no invalid objects are registered. */ public void checkInvalidObject(Object object, CacheKey cacheKey, ClassDescriptor descriptor) { if (!isNestedUnitOfWork() && (cacheKey.getObject() != null)) { CacheInvalidationPolicy cachePolicy = descriptor.getCacheInvalidationPolicy(); // BUG#6671556 refresh invalid objects when accessed in the unit of work. if (cachePolicy.shouldRefreshInvalidObjectsInUnitOfWork() && cachePolicy.isInvalidated(cacheKey)) { ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(object.getClass()); query.setSelectionKey(cacheKey.getKey()); query.refreshIdentityMapResult(); query.setIsExecutionClone(true); parent.executeQuery(query); } } }