1 22 package com.geinuke.dao; 23 24 import java.util.ArrayList ; 25 import java.util.List ; 26 27 import com.geinuke.bizlogic.BLException; 28 import com.geinuke.vo.NewsVO; 29 import com.geinuke.vo.PMessageVO; 30 31 public class PMessageDAO extends GeiDAO{ 32 33 34 public PMessageDAO() throws Exception { 35 super(); 36 37 } 38 39 40 public PMessageVO getPMessageById(int id) throws Exception { 41 PMessageVO m=null; 42 try{ 43 this.sqlMap().startTransaction(); 44 m=(PMessageVO)this.sqlMap().queryForObject("getPMessageById",new Integer (id)); 45 this.sqlMap().commitTransaction(); 46 }finally{ 47 this.sqlMap().endTransaction(); 48 } 49 return m; 50 } 51 52 public List getReceivedPMessagesByUId(int uid) throws Exception { 53 List list=null; 54 try{ 55 this.sqlMap().startTransaction(); 56 list=this.sqlMap().queryForList("getReceivedPMessagesByUId",new Integer (uid)); 57 this.sqlMap().commitTransaction(); 58 }finally{ 59 this.sqlMap().endTransaction(); 60 } 61 return list; 62 } 63 64 public List getSentPMessagesByUId(int uid) throws Exception { 65 List list=null; 66 try{ 67 this.sqlMap().startTransaction(); 68 list=this.sqlMap().queryForList("getSentPMessagesByUId",new Integer (uid)); 69 this.sqlMap().commitTransaction(); 70 }finally{ 71 this.sqlMap().endTransaction(); 72 } 73 return list; 74 } 75 76 public void deletePMessageByPID(int pid) throws Exception { 77 try{ 78 this.sqlMap().startTransaction(); 79 this.sqlMap().delete("deletePMessageByPID",new Integer (pid)); 80 this.sqlMap().commitTransaction(); 81 }finally{ 82 this.sqlMap().endTransaction(); 83 } 84 } 85 86 public void updatePMessage(PMessageVO p) throws Exception { 87 try{ 88 this.sqlMap().startTransaction(); 89 this.sqlMap().update("updatePMessageByPID",p); 90 this.sqlMap().commitTransaction(); 91 }finally{ 92 this.sqlMap().endTransaction(); 93 } 94 } 95 96 public void addPMessage(PMessageVO p) throws Exception { 97 try{ 98 this.sqlMap().startTransaction(); 99 this.sqlMap().insert("addPMessage",p); 100 this.sqlMap().commitTransaction(); 101 }finally{ 102 this.sqlMap().endTransaction(); 103 } 104 } 105 106 } 107 | Popular Tags |