Code example for SessionFactory

Methods: getCurrentSession

0
			throw re;
		} 
	} 
	public List<UserAffiliationEntity> findUserOrgByUser(String userId) {
 
		Session session = sessionFactory.getCurrentSession();
        Criteria criteria = session.createCriteria(UserAffiliationEntity.class)
                .createAlias("user","user")
                .add(Restrictions.eq("user.userId", userId))
                .addOrder(Order.asc("user.userId"));
 
		List<UserAffiliationEntity> result = (List<UserAffiliationEntity>)criteria.list();
		if (result == null || result.size() == 0)
			return null; 
		return result;
	} 
 
	public List<OrganizationEntity> findOrgAffiliationsByUser(String userId) {
		Session session = sessionFactory.getCurrentSession();
 
Experience pair programming with AI  Get Codota for Java