Code example for SessionFactory

Methods: getCurrentSession

0
	 * Return a list of OrganizationAttribute objects for the organization that is specified by the parentId 
	 * @param parentId 
	 * @return 
	 */ 
	public List<OrganizationAttributeEntity> findAttributesByParent(String parentId) {
		Session session = sessionFactory.getCurrentSession();
        Criteria criteria = session.createCriteria(OrganizationAttributeEntity.class)
                .createAlias("organization","o")
                .add(Restrictions.eq("o.orgId",parentId))
                .addOrder(Order.asc("name"));
		List<OrganizationAttributeEntity> results = (List<OrganizationAttributeEntity>)criteria.list();
		return results;
	} 
	/** 
	 * Removes all the OrganizationAttributes that are associated with the Organization specified by the parentId. 
	 * @param parentId 
	 * @return The number of entities deleted. 
	 */ 
	public int removeAttributesByParent(String parentId) {
		Session session = sessionFactory.getCurrentSession();