@Override
    public <T> Iterable<T> getAllObjects(Class<T> clazz) {
        Session session = null;
        LinkedList<T> list = new LinkedList<>();
        
        try{
            session = sessionFactory.getCurrentSession();
            
            session.beginTransaction();
            
            Criteria criteria = session.createCriteria(clazz);
            
            list.addAll(criteria.list());
            
            session.getTransaction().commit();
            
        }catch(RuntimeException e){
            try{
                    session.getTransaction().rollback();
            }catch(RuntimeException rbe){
            }
            throw e;
        }
        finally{
            if (session != null && session.isOpen()){
                session.close();
            }
        }
        return list;              
    }