Code example for SessionFactory

Methods: getCurrentSession

0
			throw re;
		} 
	} 
	 
	public List<UserAttributeEntity> findUserAttributes(String userId) {
		Session session = sessionFactory.getCurrentSession();
        Criteria criteria = session.createCriteria(UserAttributeEntity.class).add(Restrictions.eq("user.userId",userId)).addOrder(Order.asc("name"));
		List<UserAttributeEntity> results = (List<UserAttributeEntity>)criteria.list();
		return results;
	} 
	 
	public void deleteUserAttributes(String userId) {
		Session session = sessionFactory.getCurrentSession();
		Query qry = session.createQuery("delete org.openiam.idm.srvc.user.domain.UserAttributeEntity ua " +
					" where ua.user.userId = :userId "); 
		qry.setString("userId", userId);
		qry.executeUpdate();
 
		 
	}