@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((entity == null) ? 0 : entity.hashCode()); result = prime * result + ((operationType == null) ? 0 : operationType.hashCode()); return result; }
/** * Checks if the reason for a persistence exception was the foreign-key referencing of a (currently) * non-existing entity. This might happen with concurrent transactions, leading to an * OptimisticLockingException. * * @param failedOperation * @return */ private boolean isOptimisticLockingException(DbOperation failedOperation, Throwable cause) { boolean isConstraintViolation = ExceptionUtil.checkForeignKeyConstraintViolation(cause); boolean isVariableIntegrityViolation = ExceptionUtil.checkVariableIntegrityViolation(cause); if (isVariableIntegrityViolation) { return true; } else if ( isConstraintViolation && failedOperation instanceof DbEntityOperation && ((DbEntityOperation) failedOperation).getEntity() instanceof HasDbReferences && (failedOperation.getOperationType().equals(DbOperationType.INSERT) || failedOperation.getOperationType().equals(DbOperationType.UPDATE)) ) { DbEntity entity = ((DbEntityOperation) failedOperation).getEntity(); for (Map.Entry<String, Class> reference : ((HasDbReferences)entity).getReferencedEntitiesIdAndClass().entrySet()) { DbEntity referencedEntity = this.persistenceSession.selectById(reference.getValue(), reference.getKey()); if (referencedEntity == null) { return true; } } } return false; }
/** * Checks if the reason for a persistence exception was the foreign-key referencing of a (currently) * non-existing entity. This might happen with concurrent transactions, leading to an * OptimisticLockingException. * * @param failedOperation * @return */ private boolean isOptimisticLockingException(DbOperation failedOperation, Throwable cause) { boolean isConstraintViolation = ExceptionUtil.checkForeignKeyConstraintViolation(cause); boolean isVariableIntegrityViolation = ExceptionUtil.checkVariableIntegrityViolation(cause); if (isVariableIntegrityViolation) { return true; } else if ( isConstraintViolation && failedOperation instanceof DbEntityOperation && ((DbEntityOperation) failedOperation).getEntity() instanceof HasDbReferences && (failedOperation.getOperationType().equals(DbOperationType.INSERT) || failedOperation.getOperationType().equals(DbOperationType.UPDATE)) ) { DbEntity entity = ((DbEntityOperation) failedOperation).getEntity(); for (Map.Entry<String, Class> reference : ((HasDbReferences)entity).getReferencedEntitiesIdAndClass().entrySet()) { DbEntity referencedEntity = this.persistenceSession.selectById(reference.getValue(), reference.getKey()); if (referencedEntity == null) { return true; } } } return false; }
thisOperation.setRowsAffected(statementResult); if (thisOperation instanceof DbEntityOperation && ((DbEntityOperation) thisOperation).getEntity() instanceof HasDbRevision && !thisOperation.getOperationType().equals(DbOperationType.INSERT)) { final DbEntity dbEntity = ((DbEntityOperation) thisOperation).getEntity(); if (statementResult != 1) { } else { if (thisOperation.getOperationType().equals(DbOperationType.UPDATE)) { HasDbRevision versionedObject = (HasDbRevision) dbEntity; versionedObject.setRevision(versionedObject.getRevisionNext());
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((entity == null) ? 0 : entity.hashCode()); result = prime * result + ((operationType == null) ? 0 : operationType.hashCode()); return result; }
thisOperation.setRowsAffected(statementResult); if (thisOperation instanceof DbEntityOperation && ((DbEntityOperation) thisOperation).getEntity() instanceof HasDbRevision && !thisOperation.getOperationType().equals(DbOperationType.INSERT)) { final DbEntity dbEntity = ((DbEntityOperation) thisOperation).getEntity(); if (statementResult != 1) { } else { if (thisOperation.getOperationType().equals(DbOperationType.UPDATE)) { HasDbRevision versionedObject = (HasDbRevision) dbEntity; versionedObject.setRevision(versionedObject.getRevisionNext());
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((entity == null) ? 0 : entity.hashCode()); result = prime * result + ((operationType == null) ? 0 : operationType.hashCode()); return result; }
/** * Checks if the reason for a persistence exception was the foreign-key referencing of a (currently) * non-existing entity. This might happen with concurrent transactions, leading to an * OptimisticLockingException. * * @param failedOperation * @return */ private boolean isOptimisticLockingException(DbOperation failedOperation, Throwable cause) { boolean isConstraintViolation = ExceptionUtil.checkForeignKeyConstraintViolation(cause); boolean isVariableIntegrityViolation = ExceptionUtil.checkVariableIntegrityViolation(cause); if (isVariableIntegrityViolation) { return true; } else if ( isConstraintViolation && failedOperation instanceof DbEntityOperation && ((DbEntityOperation) failedOperation).getEntity() instanceof HasDbReferences && (failedOperation.getOperationType().equals(DbOperationType.INSERT) || failedOperation.getOperationType().equals(DbOperationType.UPDATE)) ) { DbEntity entity = ((DbEntityOperation) failedOperation).getEntity(); for (Map.Entry<String, Class> reference : ((HasDbReferences)entity).getReferencedEntitiesIdAndClass().entrySet()) { DbEntity referencedEntity = this.persistenceSession.selectById(reference.getValue(), reference.getKey()); if (referencedEntity == null) { return true; } } } return false; }
thisOperation.setRowsAffected(statementResult); if (thisOperation instanceof DbEntityOperation && ((DbEntityOperation) thisOperation).getEntity() instanceof HasDbRevision && !thisOperation.getOperationType().equals(DbOperationType.INSERT)) { final DbEntity dbEntity = ((DbEntityOperation) thisOperation).getEntity(); if (statementResult != 1) { } else { if (thisOperation.getOperationType().equals(DbOperationType.UPDATE)) { HasDbRevision versionedObject = (HasDbRevision) dbEntity; versionedObject.setRevision(versionedObject.getRevisionNext());