package edu.northwestern.bioinformatics.studycalendar.dao;

import org.springframework.transaction.annotation.Transactional;
import edu.northwestern.bioinformatics.studycalendar.domain.Study;
import edu.northwestern.bioinformatics.studycalendar.domain.StudyParticipantAssignment;

import java.util.List;

/**
 * @author Rhett Sutphin
 */
@Transactional(readOnly = true)
public class StudyDao extends StudyCalendarGridIdentifiableDao<Study> {
    public Class<Study> domainClass() {
        return Study.class;
    }

    @Transactional(readOnly = false)
    public void save(Study study) {
        getHibernateTemplate().saveOrUpdate(study);
    }

    public List<Study> getAll() {
        return getHibernateTemplate().find("from Study");
    }

    public List<StudyParticipantAssignment> getAssignmentsForStudy(Integer studyId) {
        return getHibernateTemplate().find(
            "select a from StudyParticipantAssignment a inner join a.studySite ss inner join a.participant p where ss.study.id = ? order by p.lastName, p.firstName", 
            studyId);
    }
    
    public Study getById(int id) {
        return (Study) getHibernateTemplate().get(Study.class, new Integer(id));
    }
}

@@ -435,16 +435,30 @@
 tudy%3E %7B%0A
+    @Override%0A
     publ
@@ -485,24 +485,24 @@
 inClass() %7B%0A
-
         retu
@@ -648,32 +648,71 @@
 (study);%0A    %7D%0A%0A
+    @SuppressWarnings(%7B %22unchecked%22 %7D)%0A
     public List%3C
@@ -790,24 +790,63 @@
 y%22);%0A    %7D%0A%0A
+    @SuppressWarnings(%7B %22unchecked%22 %7D)%0A
     public L
@@ -1130,16 +1130,16 @@
 Name%22, %0A
+
         
@@ -1162,133 +1162,6 @@
   %7D%0A
-    %0A    public Study getById(int id) %7B%0A        return (Study) getHibernateTemplate().get(Study.class, new Integer(id));%0A    %7D%0A
 %7D%0A

Remove unnecessary override of getById