Last active
          May 7, 2016 07:42 
        
      - 
      
- 
        Save nobodyiam/3db4bcaa5a694d26e2fcd08678cf39e2 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class OpenEntityManagerInViewInterceptor extends EntityManagerFactoryAccessor implements AsyncWebRequestInterceptor { | |
| @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()); | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment