예제 #1
0
  @Override
  protected void doShutdown() throws Exception {
    if (entityManager != null) {
      this.entityManager.close();
      LOG.trace("Closed EntityManager {} on {}", entityManager, this);
    }

    super.doShutdown();
  }
예제 #2
0
  @Override
  protected void doStart() throws Exception {
    // need to setup entity manager first
    if (getEndpoint().isSharedEntityManager()) {
      this.entityManager =
          SharedEntityManagerCreator.createSharedEntityManager(entityManagerFactory);
    } else {
      this.entityManager = entityManagerFactory.createEntityManager();
    }
    LOG.trace("Created EntityManager {} on {}", entityManager, this);

    super.doStart();
  }