コード例 #1
0
  public void afterPropertiesSet() throws Exception {
    super.afterPropertiesSet();

    if (queryProvider == null) {
      Assert.notNull(entityManagerFactory);
      Assert.hasLength(queryString);
    }
    // making sure that the appropriate (JPA) query provider is set
    else {
      Assert.isTrue(queryProvider != null, "JPA query provider must be set");
    }
  }
コード例 #2
0
  @Override
  protected void doOpen() throws Exception {
    super.doOpen();

    entityManager = entityManagerFactory.createEntityManager(jpaPropertyMap);
    if (entityManager == null) {
      throw new DataAccessResourceFailureException("Unable to obtain an EntityManager");
    }
    // set entityManager to queryProvider, so it participates
    // in JpaPagingItemReader's managed transaction
    if (queryProvider != null) {
      queryProvider.setEntityManager(entityManager);
    }
  }
コード例 #3
0
 @Override
 protected void doClose() throws Exception {
   entityManager.close();
   super.doClose();
 }