1 package org.smartcomps.twister.engine.priv.timer.dao;
2
3 import org.smartcomps.twister.common.persistence.PersistentDataAccess;
4 import org.smartcomps.twister.common.persistence.DBSessionManager;
5 import org.smartcomps.twister.common.persistence.DBSessionException;
6 import org.smartcomps.twister.engine.priv.timer.po.ECTaskPersister;
7
8 import net.sf.hibernate.Session;
9 import net.sf.hibernate.Hibernate;
10 import net.sf.hibernate.HibernateException;
11
12 import java.util.List;
13
14 /***
15 * DAO for execution context tasks.
16 */
17 public class ECTaskDAO extends PersistentDataAccess {
18
19 private static String FINDBY_ECID =
20 "FROM org.smartcomps.twister.engine.priv.timer.po.ECTaskPersister as ectask " +
21 "WHERE ectask.ecId = ?";
22
23 public static ECTaskPersister findByECId(Long ecId) throws DBSessionException {
24 Session session = DBSessionManager.getActiveSession();
25
26 List results = null;
27 try {
28 results = session.find(FINDBY_ECID, ecId, Hibernate.LONG);
29 } catch (HibernateException e) {
30 throw new DBSessionException(e);
31 }
32 return (ECTaskPersister) results.get(0);
33
34 }
35 }
This page was automatically generated by Maven