@Override
  protected void deactivate(ComponentContext context, Map<String, Object> properties) {
    super.deactivate(context, properties);

    getEntityManager().close();
  }
  @Override
  protected void activate(ComponentContext context, Map<String, Object> properties) {
    super.activate(context, properties);

    if (entityManagerFactory != null) entityManager = entityManagerFactory.createEntityManager();
  }