IsDirectedByCourseTeacher isDirected = new IsDirectedByCourseTeacher((User) i.next(), course);
IsDirectedByCourseTeacher isDirected = (IsDirectedByCourseTeacher) i.next();
	public void addCourse(Course course) throws RemoteException, HibernateException {	    Session session = null;        try {            TransactionManager.beginTransaction();            session = Hibernate.getCurrentSession();            add(course, session);            Set p = course.getGroupsSubjectsTakingPart();            if (p != null) {	            for (Iterator i = p.iterator(); i.hasNext(); ) {	                TakePartGroupSubjectCourse takePart = (TakePartGroupSubjectCourse)i.next();	                takePart.setIdCourse(course.getIdCourse());	                add(takePart, session);	            }            }            Collection c = course.getTeachersDirecting();            if (c != null) {	            for (Iterator i = c.iterator(); i.hasNext(); ) {	                IsDirectedByCourseTeacher isDirected = new IsDirectedByCourseTeacher((User) i.next(), course);	                add(isDirected, session);	            }            }            TransactionManager.commit();        } catch (HibernateException e) {            TransactionManager.rollback();            throw e;        } finally {            Hibernate.closeSession();        }	}