/**
   * This method will be used to close the session with the database. Declared in AbstractDAO class.
   *
   * @throws DAOException
   */
  public void closeSession() throws DAOException {

    try {
      DBUtil.closeSession();
      //   Logger.out.info("-------------close session------------");
    } catch (HibernateException dx) {
      Logger.out.error(dx.getMessage(), dx);
      throw handleError(Constants.GENERIC_DATABASE_ERROR, dx);
    }
    session = null;
    transaction = null;
    auditManager = null;
  }
  /**
   * This method will be used to establish the session with the database. Declared in AbstractDAO
   * class.
   *
   * @throws DAOException
   */
  public void openSession(SessionDataBean sessionDataBean) throws DAOException {
    // Logger.out.info("Session opened:------------------------");
    try {
      session = DBUtil.currentSession();

      // Logger.out.info("Transaction begin:---------------------");
      transaction = session.beginTransaction();

      auditManager = new AuditManager();

      if (sessionDataBean != null) {
        auditManager.setUserId(sessionDataBean.getUserId());
        auditManager.setIpAddress(sessionDataBean.getIpAddress());
      } else {
        auditManager.setUserId(null);
      }
    } catch (HibernateException dbex) {
      Logger.out.error(dbex.getMessage(), dbex);
      throw handleError(Constants.GENERIC_DATABASE_ERROR, dbex);
    }
  }