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


Java EntityManagerFactoryUtils.closeEntityManager方法代码示例

本文整理汇总了Java中org.springframework.orm.jpa.EntityManagerFactoryUtils.closeEntityManager方法的典型用法代码示例。如果您正苦于以下问题:Java EntityManagerFactoryUtils.closeEntityManager方法的具体用法?Java EntityManagerFactoryUtils.closeEntityManager怎么用?Java EntityManagerFactoryUtils.closeEntityManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.orm.jpa.EntityManagerFactoryUtils的用法示例。


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

示例1: afterCompletion

import org.springframework.orm.jpa.EntityManagerFactoryUtils; //导入方法依赖的package包/类
@Override
public void afterCompletion(WebRequest request, Exception ex) throws DataAccessException {
	if (!decrementParticipateCount(request)) {
		EntityManagerHolder emHolder = (EntityManagerHolder)
				TransactionSynchronizationManager.unbindResource(getEntityManagerFactory());
		logger.debug("Closing JPA EntityManager in OpenEntityManagerInViewInterceptor");
		EntityManagerFactoryUtils.closeEntityManager(emHolder.getEntityManager());
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:OpenEntityManagerInViewInterceptor.java

示例2: closeEntityManager

import org.springframework.orm.jpa.EntityManagerFactoryUtils; //导入方法依赖的package包/类
/**
 * close the entity manager.
 * Use it with caution! This is only intended for use with async request, which Spring won't
 * close the entity manager until the async request is finished.
 */
public void closeEntityManager() {
  EntityManagerHolder emHolder = (EntityManagerHolder)
      TransactionSynchronizationManager.getResource(getEntityManagerFactory());
  if (emHolder == null) {
    return;
  }
  logger.debug("Closing JPA EntityManager in EntityManagerUtil");
  EntityManagerFactoryUtils.closeEntityManager(emHolder.getEntityManager());
}
 
开发者ID:dewey-its,项目名称:apollo-custom,代码行数:15,代码来源:EntityManagerUtil.java

示例3: closeEntityManager

import org.springframework.orm.jpa.EntityManagerFactoryUtils; //导入方法依赖的package包/类
/**
 * Suppression du EntityManager.
 */
public void closeEntityManager() {
	if (TransactionSynchronizationManager.hasResource(entityManagerFactory)) {
		EntityManagerHolder entityManagerHolder = (EntityManagerHolder) TransactionSynchronizationManager.unbindResource(entityManagerFactory);
		EntityManagerFactoryUtils.closeEntityManager(entityManagerHolder.getEntityManager());
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:10,代码来源:EntityManagerUtils.java

示例4: afterCompletion

import org.springframework.orm.jpa.EntityManagerFactoryUtils; //导入方法依赖的package包/类
public void afterCompletion(WebRequest request, Exception ex) throws DataAccessException {
	if (!decrementParticipateCount(request)) {
		EntityManagerHolder emHolder = (EntityManagerHolder)
				TransactionSynchronizationManager.unbindResource(getEntityManagerFactory());
		logger.debug("Closing JPA EntityManager in OpenEntityManagerInViewInterceptor");
		EntityManagerFactoryUtils.closeEntityManager(emHolder.getEntityManager());
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:9,代码来源:OpenEntityManagerInViewInterceptor.java

示例5: execute

import org.springframework.orm.jpa.EntityManagerFactoryUtils; //导入方法依赖的package包/类
@Override
public void execute() throws Exception {
    EntityManager em = emf.createEntityManager();
    EntityManagerHolder emHolder = new EntityManagerHolder(em);
    try {
        TransactionSynchronizationManager.bindResource(emf, emHolder);
        super.execute();
    } finally {
        EntityManagerHolder emHolderB = (EntityManagerHolder)
                TransactionSynchronizationManager.unbindResource(emf);
        log.debug("Closing JPA EntityManager in OpenEntityManagerInViewFilter");
        EntityManagerFactoryUtils.closeEntityManager(emHolderB.getEntityManager());
    }
    sleep(DateTry.Second*10);
}
 
开发者ID:OlegNyr,项目名称:GisGMP,代码行数:16,代码来源:SenderIteration.java

示例6: postProcessBeforeDestruction

import org.springframework.orm.jpa.EntityManagerFactoryUtils; //导入方法依赖的package包/类
@Override
public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException {
	EntityManager emToClose = this.extendedEntityManagersToClose.remove(bean);
	EntityManagerFactoryUtils.closeEntityManager(emToClose);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:PersistenceAnnotationBeanPostProcessor.java

示例7: closeAfterTimeout

import org.springframework.orm.jpa.EntityManagerFactoryUtils; //导入方法依赖的package包/类
private void closeAfterTimeout() {
	if (this.timeoutInProgress) {
		logger.debug("Closing JPA EntityManager after async request timeout");
		EntityManagerFactoryUtils.closeEntityManager(emHolder.getEntityManager());
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:AsyncRequestInterceptor.java

示例8: postProcessBeforeDestruction

import org.springframework.orm.jpa.EntityManagerFactoryUtils; //导入方法依赖的package包/类
public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException {
	EntityManager emToClose = this.extendedEntityManagersToClose.remove(bean);
	EntityManagerFactoryUtils.closeEntityManager(emToClose);
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:5,代码来源:PersistenceAnnotationBeanPostProcessor.java


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