1 16 17 package org.javabb.dao.hibernate; 18 19 import java.util.Iterator ; 20 import java.util.List ; 21 22 import org.javabb.dao.entity.IPrivMsgSentDAO; 23 import org.javabb.vo.PrivMsg; 24 import org.javabb.vo.PrivMsgSent; 25 import org.javabb.vo.User; 26 27 30 31 public class PrivMsgSentHibernateDAO extends HibernateDAO implements IPrivMsgSentDAO { 32 33 public List retrieveUserOutbox(User u) throws Exception { 34 return find(PrivMsgSent.class, "o.userFrom.idUser=?", new Object [] { u.getId() }, 35 "o.data DESC", ALL_PAGES, 0); 36 } 37 38 public PrivMsgSent load(Long id) throws Exception { 39 return (PrivMsgSent) getHibernateTemplate().load(PrivMsgSent.class, id); 40 } 41 42 public void save(PrivMsgSent p) throws Exception { 43 getHibernateTemplate().save(p); 44 } 45 46 public void delete(PrivMsgSent p) throws Exception { 47 getHibernateTemplate().delete(p); 48 } 49 50 public void delete(List l) throws Exception { 51 String sql = "delete from jbb_privmsg_outbox where id_privmsg in ("; 52 for (Iterator i=l.iterator(); i.hasNext(); ) 53 sql+= ((PrivMsg) i.next()).getId() + ","; 54 sql = sql.substring(0, sql.length()-1); 55 sql += ");"; 56 this.executeSQL(sql); 57 } 58 } 59 | Popular Tags |