package cn.updev.Events.Group;

import cn.updev.Database.HibernateSessionFactory;
import org.hibernate.Session;

/**
 * Created by hypo on 15-11-18.
 */
public class EventGroupDAO {

    private Session session;

    public EventGroupDAO() {

        this.session = HibernateSessionFactory.currentSession();
    }

    protected void finalize(){
        HibernateSessionFactory.closeSession();
    }

}

@@ -86,224 +86,1313 @@
 ort 
-org.hibernate.Session;%0A%0A/**%0A * Created by hypo on 15-11-18.%0A */%0Apublic class EventGroupDAO %7B%0A%0A    private Session session;%0A%0A    public EventGroupDAO() %7B%0A%0A        this.session = HibernateSessionFactory.currentSession(
+cn.updev.Events.Event.EventDAO;%0Aimport cn.updev.Events.Static.IEvent;%0Aimport cn.updev.Events.Static.ITeamEvents;%0Aimport cn.updev.Events.Static.IUserEvents;%0Aimport org.hibernate.Query;%0Aimport org.hibernate.Session;%0A%0Aimport java.util.List;%0A%0A/**%0A * Created by hypo on 15-11-18.%0A */%0Apublic class EventGroupDAO %7B%0A%0A    private Session session;%0A%0A    public EventGroupDAO() %7B%0A%0A        this.session = HibernateSessionFactory.currentSession();%0A    %7D%0A%0A    public ITeamEvents getTeamEventGroup(Integer groupId)%7B%0A        Query query =session.createQuery(%22from EventGroupInfo info where info.groupId=%22 + groupId);%0A%0A        if(query.list().size() == 0)%7B%0A            return null;%0A        %7D%0A%0A        List%3CIEvent%3E events = new EventDAO().getEventByEventGroupId(groupId);%0A        EventGroupInfo group = (EventGroupInfo)query.list().get(0);%0A        return new TeamEventGroup(group, events);%0A    %7D%0A%0A    public IUserEvents getUserEventGroup(Integer groupId)%7B%0A        Query query =session.createQuery(%22from EventGroupInfo info where info.groupId=%22 + groupId);%0A%0A        if(query.list().size() == 0)%7B%0A            return null;%0A        %7D%0A%0A        List%3CIEvent%3E events = new EventDAO().getEventByEventGroupId(groupId);%0A        EventGroupInfo group = (EventGroupInfo)query.list().get(0);%0A        return new UserEventGroup(group, events
 );%0A 

update EventGroupDAO