| 1 2 23 package com.geinuke.dao; 24 25 import java.util.ArrayList ; 26 import java.util.List ; 27 28 import com.geinuke.vo.SessionVO; 29 30 public class SessionDAO extends GeiDAO{ 31 32 33 public SessionDAO() throws Exception { 34 super(); 35 36 } 37 38 public void insertSession(SessionVO s) throws Exception { 39 40 try{ 41 this.sqlMap().startTransaction(); 42 this.sqlMap().insert("insSession",s); 43 this.sqlMap().commitTransaction(); 44 }finally{ 45 this.sqlMap().endTransaction(); 46 } 47 48 } 49 50 public void deleteExpiredSessions(long deadline) throws Exception { 51 52 try{ 53 this.sqlMap().startTransaction(); 54 this.sqlMap().delete("deleteExpiredSessions",new Long (deadline)); 55 this.sqlMap().commitTransaction(); 56 }finally{ 57 this.sqlMap().endTransaction(); 58 } 59 60 } 61 62 public void deleteSession(SessionVO s) throws Exception { 63 64 try{ 65 this.sqlMap().startTransaction(); 66 this.sqlMap().delete("deleteSession",s); 67 this.sqlMap().commitTransaction(); 68 }finally{ 69 this.sqlMap().endTransaction(); 70 } 71 72 } 73 74 75 public SessionVO getSessionByID(SessionVO s) throws Exception { 76 SessionVO ses=null; 77 try{ 78 this.sqlMap().startTransaction(); 79 ses=(SessionVO)this.sqlMap().queryForObject("getSessionByID",s); 80 this.sqlMap().commitTransaction(); 81 }finally{ 82 this.sqlMap().endTransaction(); 83 } 84 return ses; 85 } 86 87 public ArrayList getSessionsByIdRole(int idr) throws Exception { 88 ArrayList list=null; 89 List llist=null; 90 try{ 91 this.sqlMap().startTransaction(); 92 llist=(List )this.sqlMap().queryForList("getSessionsByIdR",new Integer (idr)); 93 this.sqlMap().commitTransaction(); 94 }finally{ 95 this.sqlMap().endTransaction(); 96 } 97 list=new ArrayList (llist); 98 return list; 99 } 100 101 public ArrayList getSessions() throws Exception { 102 103 ArrayList list=null; 104 List aux=null; 105 try{ 106 this.sqlMap().startTransaction(); 107 aux=(List )this.sqlMap().queryForList("getSessions",""); 108 this.sqlMap().commitTransaction(); 109 110 }finally{ 111 this.sqlMap().endTransaction(); 112 } 113 list=new ArrayList (aux); 114 return list; 115 } 116 117 118 public ArrayList getLastSessions(int rId) throws Exception { 119 120 ArrayList list=null; 121 List aux=null; 122 try{ 123 this.sqlMap().startTransaction(); 124 aux=(List )this.sqlMap().queryForList("getLastSessions",new Integer (rId)); 125 this.sqlMap().commitTransaction(); 126 127 }finally{ 128 this.sqlMap().endTransaction(); 129 } 130 list=new ArrayList (aux); 131 return list; 132 } 133 } 134 | Popular Tags |