Code example for SessionFactory

Methods: getCurrentSession

0
	 *      org.openmrs.activelist.ActiveListType) 
	 */ 
	@SuppressWarnings("unchecked") 
	public <T extends ActiveListItem> List<T> getActiveListItems(Class<T> clazz, Person p, ActiveListType type)
	        throws DAOException { 
		Criteria criteria = sessionFactory.getCurrentSession().createCriteria(clazz);
		criteria.add(Restrictions.eq("activeListType", type));
		criteria.add(Restrictions.eq("person", p));
		criteria.add(Restrictions.eq("voided", Boolean.FALSE));
		criteria.addOrder(Order.desc("startDate"));
		return criteria.list();
	} 
	 
	/** 
	 * @see org.openmrs.api.db.ActiveListDAO#getActiveListItem(java.lang.Class, java.lang.Integer) 
	 */ 
	@SuppressWarnings("unchecked") 
	public <T extends ActiveListItem> T getActiveListItem(Class<T> clazz, Integer activeListItemId) throws DAOException {
		Criteria criteria = sessionFactory.getCurrentSession().createCriteria(clazz);
		criteria.add(Restrictions.eq("activeListId", activeListItemId));
Connect your IDE to all the code out there  Get Codota for Java