public static boolean updateEventUserStatus(int eventId, int userId,
			int statusCode) throws HibernateException {
		boolean isUpdateEventUserStatusSuccessful = false;
		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
		try {
			// Begin unit of work
			session.beginTransaction();

			// update event status
			String hql = "select eu from EventUserInfo as eu where eu.userId="
					+ userId + " and eu.eventId=" + eventId;

			Query query = session.createQuery(hql);

			@SuppressWarnings("unchecked")
			List<EventUserInfo> list = query.list();

			if (list.size() > 0) {
				EventUserInfo eventUserEntity = list.get(0);
				if (eventUserEntity.getUserStatus() != statusCode) {
					eventUserEntity.setUserStatus(statusCode);
					session.save(eventUserEntity);
				}
				isUpdateEventUserStatusSuccessful = true;
			}

			// End unit of work
			session.getTransaction().commit();

		} catch (HibernateException hex) {
			logger.error(hex.toString());
			HibernateUtil.getSessionFactory().getCurrentSession()
					.getTransaction().rollback();
		} catch (Exception ex) {
			logger.error(ex.toString());
			HibernateUtil.getSessionFactory().getCurrentSession()
					.getTransaction().rollback();
		}
		return isUpdateEventUserStatusSuccessful;

	}