/** This convenience method is set aside for readability. */
  private void getHibernateSession() {
    // import org.jboss.jpa.tx.TransactionScopedEntityManager;

    // Find a method for getting a hibernate session.
    Method[] emMethods = em.getClass().getMethods();
    for (Method method : emMethods) {
      if (method.getName().equals("getHibernateSession")) {
        // Once found, invoke the method.
        try {
          Object returnObj = method.invoke(em);
          if (returnObj instanceof Session) {
            session = (Session) returnObj;
          } else {
            logger.warn(
                "Invoking 'getHibernateSession()' returned type of "
                    + returnObj.getClass().getName()
                    + " instead of a hibernate session.");
          }
        } catch (Exception ex) {
          logger.error(
              "Failed to invoke the getter to obtain the hibernate session " + ex.getMessage());
          ex.printStackTrace();
        }
      }
    }

    if (session == null) {
      logger.error("Failed to find hibernate session from " + em.toString());
    }
  }
 @PostConstruct
 public void init() {
   logger.info("in EventCauseServiceEJB.init");
   logger.info(em.toString());
 }