Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dao/hibernate/NoticeboardUserDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dao/hibernate/NoticeboardUserDAO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dao/hibernate/NoticeboardUserDAO.java 5 Jul 2005 06:38:59 -0000 1.1 @@ -0,0 +1,121 @@ +/* +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +USA + +http://www.gnu.org/licenses/gpl.txt +*/ + +/* + * Created on Jul 1, 2005 + */ +package org.lamsfoundation.lams.tool.noticeboard.dao.hibernate; + +import java.util.List; + +import org.lamsfoundation.lams.tool.noticeboard.dao.INoticeboardUserDAO; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardUser; +import org.springframework.orm.hibernate.support.HibernateDaoSupport; +/** + * @author mtruong + */ +public class NoticeboardUserDAO extends HibernateDaoSupport implements INoticeboardUserDAO { + + /** + *
Return the persistent instance of a NoticeboardUser
+ * with the given identifier uid
, returns null if not found.
Return the persistent instance of a NoticeboardUser
+ * with the given user id userId
,
+ * returns null if not found.
Persist the given persistent instance of NoticeboardUser.
+ * + * @param nbUser The instance of NoticeboardUser to persist. + */ + public void saveNbUser(NoticeboardUser nbUser) + { + this.getHibernateTemplate().save(nbUser); + } + + /** + *Update the given persistent instance of NoticeboardUser.
+ * + * @param nbUser The instance of NoticeboardUser to persist. + */ + public void updateNbUser(NoticeboardUser nbUser) + { + this.getHibernateTemplate().update(nbUser); + } + + /** + *Delete the given instance of NoticeboardUser with the
+ * given user id userId
+ *
+ * @param userId The noticeboard user id.
+ */
+ public void removeNbUser(Long userId)
+ {
+ String query = "from NoticeboardUser as user where user.userId =";
+ StringBuffer sb = new StringBuffer(query);
+ sb.append(userId.longValue());
+
+ String queryString = sb.toString();
+
+ this.getHibernateTemplate().delete(queryString);
+
+ }
+ /**
+ *
Delete the given instance of NoticeboardUser
+ * + * @param nbUser The instance of NoticeboardUser to delete. + */ + public void removeNbUser(NoticeboardUser nbUser) + { + this.getHibernateTemplate().delete(nbUser); + } + + +}