当前位置: 首页>>代码示例>>Java>>正文


Java HibernateOptimisticLockingFailureException类代码示例

本文整理汇总了Java中org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException的典型用法代码示例。如果您正苦于以下问题:Java HibernateOptimisticLockingFailureException类的具体用法?Java HibernateOptimisticLockingFailureException怎么用?Java HibernateOptimisticLockingFailureException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HibernateOptimisticLockingFailureException类属于org.springframework.orm.hibernate4包,在下文中一共展示了HibernateOptimisticLockingFailureException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildSaveButton

import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException; //导入依赖的package包/类
private Component buildSaveButton() {
    final Component button = new SingularButton("save-btn", getFormInstance()) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            super.onSubmit(target, form);
            try {
                saveForm(getFormInstance());
                addToastrSuccessMessage("message.success");
                atualizarContentWorklist(target);
            } catch (HibernateOptimisticLockingFailureException e) {
                getLogger().debug(e.getMessage(), e);
                addToastrErrorMessage("message.save.concurrent_error");
            }
        }
    };
    return button.add(visibleOnlyInEditionBehaviour());
}
 
开发者ID:opensingular,项目名称:singular-server,代码行数:19,代码来源:AbstractFormPage.java

示例2: updateAssignment

import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException; //导入依赖的package包/类
/**
  */
 @Override
 public void updateAssignment(final GradebookAssignment assignment)
     throws ConflictingAssignmentNameException, StaleObjectModificationException {
    	super.updateAssignment(assignment);
     try {
     	/** synchronize from external application*/
     	String oldTitle = null;
     	if(this.synchronizer != null)
     	{
     		final GradebookAssignment assign = getAssignment(assignment.getId());
     		oldTitle = assign.getName();
     	}
     	/** synchronize from external application*/
     	if(this.synchronizer != null && oldTitle != null  && !this.synchronizer.isProjectSite())
     	{
     		this.synchronizer.updateAssignment(oldTitle, assignment.getName(), assignment.getGradebook().getGrade_type());
     	}
     } catch (final HibernateOptimisticLockingFailureException holfe) {
         if(log.isInfoEnabled()) {
	log.info("An optimistic locking failure occurred while attempting to update an assignment");
}
         throw new StaleObjectModificationException(holfe);
     }
 }
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:27,代码来源:GradebookManagerHibernateImpl.java

示例3: decrementMessagesSynopticToolInfo

import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException; //导入依赖的package包/类
public void decrementMessagesSynopticToolInfo(String userId, String siteId, int numOfAttempts) {
	try {
		SynopticMsgcntrManagerCover.decrementMessagesSynopticToolInfo(Arrays.asList(userId), siteId);
	} catch (HibernateOptimisticLockingFailureException holfe) {

		// failed, so wait and try again
		try {
			Thread.sleep(SynopticMsgcntrManager.OPT_LOCK_WAIT);
		} catch (InterruptedException e) {
			log.error(e.getMessage(), e);
		}

		numOfAttempts--;

		if (numOfAttempts <= 0) {
			log.info("PrivateMessageManagerImpl: decrementMessagesSynopticToolInfo: HibernateOptimisticLockingFailureException no more retries left");
			log.error(holfe.getMessage(), holfe);
		} else {
			log.info("PrivateMessageManagerImpl: decrementMessagesSynopticToolInfo: HibernateOptimisticLockingFailureException: attempts left: "
							+ numOfAttempts);
			decrementMessagesSynopticToolInfo(userId, siteId, numOfAttempts);
		}
	}

}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:26,代码来源:PrivateMessageManagerImpl.java

示例4: incrementMessagesSynopticToolInfo

import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException; //导入依赖的package包/类
public void incrementMessagesSynopticToolInfo(String userId, String siteId , int numOfAttempts) {
	try {
		SynopticMsgcntrManagerCover.incrementMessagesSynopticToolInfo(Arrays.asList(userId), siteId);
	} catch (HibernateOptimisticLockingFailureException holfe) {

		// failed, so wait and try again
		try {
			Thread.sleep(SynopticMsgcntrManager.OPT_LOCK_WAIT);
		} catch (InterruptedException e) {
			log.error(e.getMessage(), e);
		}

		numOfAttempts--;

		if (numOfAttempts <= 0) {
			log.info("PrivateMessageManagerImpl: incrementMessagesSynopticToolInfo: HibernateOptimisticLockingFailureException no more retries left");
			log.error(holfe.getMessage(), holfe);
		} else {
			log.info("PrivateMessageManagerImpl: incrementMessagesSynopticToolInfo: HibernateOptimisticLockingFailureException: attempts left: "
							+ numOfAttempts);
			incrementMessagesSynopticToolInfo(userId, siteId, numOfAttempts);
		}
	}

}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:26,代码来源:PrivateMessageManagerImpl.java

示例5: decrementForumSynopticToolInfo

import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException; //导入依赖的package包/类
public void decrementForumSynopticToolInfo(String userId, String siteId, int numOfAttempts) {
	try {
		SynopticMsgcntrManagerCover.decrementForumSynopticToolInfo(Arrays.asList(userId), siteId);
	} catch (HibernateOptimisticLockingFailureException holfe) {

		// failed, so wait and try again
		try {
			Thread.sleep(SynopticMsgcntrManager.OPT_LOCK_WAIT);
		} catch (InterruptedException e) {
			log.error(e.getMessage(), e);
		}

		numOfAttempts--;

		if (numOfAttempts <= 0) {
			log.info("MessageForumsMessageManagerImpl: decrementForumSynopticToolInfo: HibernateOptimisticLockingFailureException no more retries left");
			log.error(holfe.getMessage(), holfe);
		} else {
			log.info("MessageForumsMessageManagerImpl: decrementForumSynopticToolInfo: HibernateOptimisticLockingFailureException: attempts left: "
					+ numOfAttempts);
			decrementForumSynopticToolInfo(userId, siteId, numOfAttempts);
		}
	}

}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:26,代码来源:MessageForumsMessageManagerImpl.java

示例6: incrementForumSynopticToolInfo

import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException; //导入依赖的package包/类
public void incrementForumSynopticToolInfo(String userId, String siteId, int numOfAttempts) {
	try {
		SynopticMsgcntrManagerCover.incrementForumSynopticToolInfo(Arrays.asList(userId), siteId);
	} catch (HibernateOptimisticLockingFailureException holfe) {

		// failed, so wait and try again
		try {
			Thread.sleep(SynopticMsgcntrManager.OPT_LOCK_WAIT);
		} catch (InterruptedException e) {
			log.error(e.getMessage(), e);
		}

		numOfAttempts--;

		if (numOfAttempts <= 0) {
			log.info("MessageForumsMessageManagerImpl: incrementForumSynopticToolInfo: HibernateOptimisticLockingFailureException no more retries left");
			log.error(holfe.getMessage(), holfe);
		} else {
			log.info("MessageForumsMessageManagerImpl: incrementForumSynopticToolInfo: HibernateOptimisticLockingFailureException: attempts left: "
					+ numOfAttempts);
			incrementForumSynopticToolInfo(userId, siteId, numOfAttempts);
		}
	}

}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:26,代码来源:MessageForumsMessageManagerImpl.java

示例7: decrementMessagesSynopticToolInfo

import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException; //导入依赖的package包/类
public void decrementMessagesSynopticToolInfo(String userId, String siteId, int numOfAttempts) {
	try {
		SynopticMsgcntrManagerCover.decrementMessagesSynopticToolInfo(Arrays.asList(userId), siteId);
	} catch (HibernateOptimisticLockingFailureException holfe) {

		// failed, so wait and try again
		try {
			Thread.sleep(SynopticMsgcntrManager.OPT_LOCK_WAIT);
		} catch (InterruptedException e) {
			log.error(e.getMessage(), e);
		}

		numOfAttempts--;

		if (numOfAttempts <= 0) {
			log.info("MessageForumsMessageManagerImpl: decrementMessagesSynopticToolInfo: HibernateOptimisticLockingFailureException no more retries left");
			log.error(holfe.getMessage(), holfe);
		} else {
			log.info("MessageForumsMessageManagerImpl: decrementMessagesSynopticToolInfo: HibernateOptimisticLockingFailureException: attempts left: "
					+ numOfAttempts);
			decrementMessagesSynopticToolInfo(userId, siteId, numOfAttempts);
		}
	}

}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:26,代码来源:MessageForumsMessageManagerImpl.java

示例8: incrementMessagesSynopticToolInfo

import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException; //导入依赖的package包/类
public void incrementMessagesSynopticToolInfo(String userId, String siteId, int numOfAttempts) {
	try {
		SynopticMsgcntrManagerCover.incrementMessagesSynopticToolInfo(Arrays.asList(userId), siteId);
	} catch (HibernateOptimisticLockingFailureException holfe) {

		// failed, so wait and try again
		try {
			Thread.sleep(SynopticMsgcntrManager.OPT_LOCK_WAIT);
		} catch (InterruptedException e) {
			log.error(e.getMessage(), e);
		}

		numOfAttempts--;

		if (numOfAttempts <= 0) {
			log.info("MessageForumsMessageManagerImpl: incrementMessagesSynopticToolInfo: HibernateOptimisticLockingFailureException no more retries left");
			log.error(holfe.getMessage(), holfe);
		} else {
			log.info("MessageForumsMessageManagerImpl: incrementMessagesSynopticToolInfo: HibernateOptimisticLockingFailureException: attempts left: "
					+ numOfAttempts);
			incrementMessagesSynopticToolInfo(userId, siteId, numOfAttempts);
		}
	}

}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:26,代码来源:MessageForumsMessageManagerImpl.java

示例9: updateSynopticMessagesForForumComparingOldMessagesCount

import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException; //导入依赖的package包/类
public void updateSynopticMessagesForForumComparingOldMessagesCount(String siteId, Long forumId, Long topicId,
		HashMap<String, Integer> beforeChangeHM, int numOfAttempts) {
	try {
		// update synotpic info for forums only:
		SynopticMsgcntrManagerCover.updateSynopticMessagesForForumComparingOldMessagesCount(siteId, forumId, topicId, beforeChangeHM);
	} catch (HibernateOptimisticLockingFailureException holfe) {

		// failed, so wait and try again
		try {
			Thread.sleep(SynopticMsgcntrManager.OPT_LOCK_WAIT);
		} catch (InterruptedException e) {
			log.warn("Thread intrrupted while updating synoptic info for forums", e);
		}

		numOfAttempts--;

		if (numOfAttempts <= 0) {
			log.warn("HibernateOptimisticLockingFailureException no more retries left", holfe);
		} else {
			log.warn("HibernateOptimisticLockingFailureException: attempts left: {}", numOfAttempts);
			updateSynopticMessagesForForumComparingOldMessagesCount(siteId, forumId, topicId, beforeChangeHM, numOfAttempts);
		}
	}
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:25,代码来源:ForumScheduleNotificationImpl.java

示例10: incrementForumSynopticToolInfo

import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException; //导入依赖的package包/类
public void incrementForumSynopticToolInfo(List<String> userIds, String siteId, int numOfAttempts){
 try {
  getSynopticMsgcntrManager().incrementForumSynopticToolInfo(userIds, siteId);
} catch (HibernateOptimisticLockingFailureException holfe) {

	// failed, so wait and try again
	try {
		Thread.sleep(SynopticMsgcntrManager.OPT_LOCK_WAIT);
	} catch (InterruptedException e) {
		log.error(e.getMessage(), e);
	}

	numOfAttempts--;

	if (numOfAttempts <= 0) {
		log.info("DiscussionForumTool: incrementForumSynopticToolInfo: HibernateOptimisticLockingFailureException no more retries left");
		log.error(holfe.getMessage(), holfe);
	} else {
		log.info("DiscussionForumTool: incrementForumSynopticToolInfo: HibernateOptimisticLockingFailureException: attempts left: "
						+ numOfAttempts);
		incrementForumSynopticToolInfo(userIds, siteId, numOfAttempts);
	}
}
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:25,代码来源:DiscussionForumTool.java

示例11: setMessagesSynopticInfoHelper

import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException; //导入依赖的package包/类
public void setMessagesSynopticInfoHelper(String userId, String siteId, int unreadMessagesCount, int numOfAttempts) {
 try {
  getSynopticMsgcntrManager().setMessagesSynopticInfoHelper(userId, siteId, unreadMessagesCount);
 } catch (HibernateOptimisticLockingFailureException holfe) {

  // failed, so wait and try again
  try {
	  Thread.sleep(SynopticMsgcntrManager.OPT_LOCK_WAIT);
  } catch (InterruptedException e) {
	  log.error(e.getMessage(), e);
  }

  numOfAttempts--;

  if (numOfAttempts <= 0) {
	  log.info("PrivateMessagesTool: setMessagesSynopticInfoHelper: HibernateOptimisticLockingFailureException no more retries left");
	  log.error(holfe.getMessage(), holfe);
  } else {
	  log.info("PrivateMessagesTool: setMessagesSynopticInfoHelper: HibernateOptimisticLockingFailureException: attempts left: "
			  + numOfAttempts);
	  setMessagesSynopticInfoHelper(userId, siteId, 
			  unreadMessagesCount, numOfAttempts);
  }
 }

}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:27,代码来源:PrivateMessagesTool.java

示例12: incrementMessagesSynopticToolInfo

import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException; //导入依赖的package包/类
public void incrementMessagesSynopticToolInfo(List<String> userIds, String siteId, int numOfAttempts) {
	try {
		getSynopticMsgcntrManager().incrementMessagesSynopticToolInfo(userIds, siteId);
	} catch (HibernateOptimisticLockingFailureException holfe) {

		// failed, so wait and try again
		try {
			Thread.sleep(SynopticMsgcntrManager.OPT_LOCK_WAIT);
		} catch (InterruptedException e) {
			log.error(e.getMessage(), e);
		}

		numOfAttempts--;

		if (numOfAttempts <= 0) {
			log.info("PrivateMessagesTool: incrementMessagesSynopticToolInfo: HibernateOptimisticLockingFailureException no more retries left");
			log.error(holfe.getMessage(), holfe);
		} else {
			log.info("PrivateMessagesTool: incrementMessagesSynopticToolInfo: HibernateOptimisticLockingFailureException: attempts left: "
							+ numOfAttempts);
			incrementMessagesSynopticToolInfo(userIds, siteId, numOfAttempts);
		}
	}

}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:26,代码来源:PrivateMessagesTool.java

示例13: onValidationSuccess

import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException; //导入依赖的package包/类
@Override
protected void onValidationSuccess(AjaxRequestTarget ajaxRequestTarget, Form<?> form, IModel<? extends SInstance> model) {
    try {
        formPage.executeTransition(ajaxRequestTarget, form, transitionName, model);
    } catch (HibernateOptimisticLockingFailureException | RequirementConcurrentModificationException e) {
        getLogger().debug(e.getMessage(), e);
        configureBackDropAndShowError(ajaxRequestTarget, "message.save.concurrent_error");
    } catch (SingularServerFormValidationError ex){
        getLogger().debug(ex.getMessage(), ex);
        configureBackDropAndShowError(ajaxRequestTarget, "message.send.error");
    }
}
 
开发者ID:opensingular,项目名称:singular-server,代码行数:13,代码来源:FlowConfirmButton.java

示例14: updateSpreadsheet

import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException; //导入依赖的package包/类
/**
 *
 * @param spreadsheet
 */
public void updateSpreadsheet(final Spreadsheet spreadsheet)throws ConflictingAssignmentNameException, StaleObjectModificationException  {
        final HibernateCallback hc = new HibernateCallback() {
            @Override
            public Object doInHibernate(final Session session) throws HibernateException {
                // Ensure that we don't have the assignment in the session, since
                // we need to compare the existing one in the db to our edited assignment
                session.evict(spreadsheet);

                final Spreadsheet sptFromDb = (Spreadsheet)session.load(Spreadsheet.class, spreadsheet.getId());
                final List conflictList = session.createQuery(
                        "select spt from Spreadsheet as spt where spt.name = :name and spt.gradebook = :gradebook and spt.id != :id").
                        setString("name", spreadsheet.getName()).
                        setEntity("gradebook", spreadsheet.getGradebook()).
                        setLong("id", spreadsheet.getId())
			.list();
	final int numNameConflicts = conflictList.size();
                if(numNameConflicts > 0) {
                    throw new ConflictingAssignmentNameException("You can not save multiple spreadsheets in a gradebook with the same name");
                }

                session.evict(sptFromDb);
                session.update(spreadsheet);

                return null;
            }
        };
        try {
            getHibernateTemplate().execute(hc);
        } catch (final HibernateOptimisticLockingFailureException holfe) {
            if(log.isInfoEnabled()) {
	log.info("An optimistic locking failure occurred while attempting to update a spreadsheet");
}
            throw new StaleObjectModificationException(holfe);
        }
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:40,代码来源:GradebookManagerHibernateImpl.java

示例15: setForumSynopticInfoHelper

import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException; //导入依赖的package包/类
public void setForumSynopticInfoHelper(String userId, String siteId,
  int unreadMessagesCount, int numOfAttempts) {
 try {
  // update synotpic info for forums only:
  getSynopticMsgcntrManager().setForumSynopticInfoHelper(userId, siteId, unreadMessagesCount);
 } catch (HibernateOptimisticLockingFailureException holfe) {

  // failed, so wait and try again
  try {
	  Thread.sleep(SynopticMsgcntrManager.OPT_LOCK_WAIT);
  } catch (InterruptedException e) {
	  log.error(e.getMessage(), e);
  }

  numOfAttempts--;

  if (numOfAttempts <= 0) {
	  log.info("DiscussionForumTool: setForumSynopticInfoHelper: HibernateOptimisticLockingFailureException no more retries left");
	  log.error(holfe.getMessage(), holfe);
  } else {
	  log.info("DiscussionForumTool: setForumSynopticInfoHelper: HibernateOptimisticLockingFailureException: attempts left: "
			  + numOfAttempts);
	  setForumSynopticInfoHelper(userId, siteId, 
			  unreadMessagesCount, numOfAttempts);
  }
 }

}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:29,代码来源:DiscussionForumTool.java


注:本文中的org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。