// ADD A EMPLOYEE BANK DETAILS IN tblempbank
  @Override
  public int addEmployeeBank(EmployeeBank employeebank)
      throws HibernateException, ConstraintViolationException {
    Session session = SessionFactoryUtil.getSessionFactory().openSession();
    int status = 0;
    try {
      session.beginTransaction();
      java.sql.Timestamp date = new java.sql.Timestamp(new java.util.Date().getTime());

      Criteria criteria = session.createCriteria(EmployeeBank.class);
      criteria.add(Restrictions.eq("organizationId", employeebank.getOrganizationId()));
      criteria.add(
          Restrictions.eq("employee", new Employee(employeebank.getEmployee().getEmployeeId())));
      criteria.add(Restrictions.eq("bank", new Bank(employeebank.getBank().getBankId())));
      if (criteria.list().size() == 0) {
        employeebank.setInsertDate(date.toString());
        employeebank.setUpdateDate(date.toString());
        session.save(employeebank);
        status = 1;
      } else {
        Iterator<EmployeeBank> iterator = criteria.list().iterator();
        while (iterator.hasNext()) {
          EmployeeBank empbank = iterator.next();
          if (empbank.getDeleteFlag() == true) {
            empbank.setDeleteFlag(false);
            empbank.setInsertDate(date.toString());
            empbank.setUpdateDate(date.toString());
            session.update(empbank);
            status = 1;
          } else {
            return 5;
          }
        }
      }

    } catch (Exception e) {
      e.printStackTrace();

    } finally {
      session.getTransaction().commit();
      session.close();
    }
    return status;
  }
 // GET A SINGLE RECORD FROM tblempbank USING empbankId
 public EmployeeBank getEmployeeBankId(int empbankId)
     throws HibernateException, ConstraintViolationException {
   Session session = SessionFactoryUtil.getSessionFactory().openSession();
   try {
     session.beginTransaction();
     EmployeeBank employeebank = (EmployeeBank) session.get(EmployeeBank.class, empbankId);
     if (employeebank != null) {
       if (!employeebank.getDeleteFlag()) {
         return employeebank;
       } else {
         return null;
       }
     } else {
       return null;
     }
   } catch (Exception e) {
     e.printStackTrace();
     return null;
   } finally {
     session.getTransaction().commit();
     session.close();
   }
 }