userinfordao.java

来自「当下流行的struts2的一个简单应用」· Java 代码 · 共 36 行

JAVA
36
字号
package com.jack.user.dao.impl;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.jack.user.dao.IUserInforDAO;
import com.jack.user.pojo.UserInfor;

public class UserInforDAO extends HibernateDaoSupport implements IUserInforDAO{
	private static final Log log = LogFactory.getLog(UserInforDAO.class);

	public void saveUserInformation(UserInfor userInfor)
			throws RuntimeException {
		log.debug("saving UserInfor instance");
		getHibernateTemplate().save(userInfor);
		log.debug("save successful");
	}

	public void updateUserInformation(UserInfor userInfor)
			throws RuntimeException {
		this.getHibernateTemplate().update(userInfor);
	}

	public UserInfor findUserInformationById(String id) throws RuntimeException {
		log.debug("getting UserInfor instance with id: " + id);
		UserInfor instance = (UserInfor) getHibernateTemplate().get(
				"com.jack.user.pojo.UserInfor", id);
		return instance;
	}

	public static UserInforDAO getFromApplicationContext(ApplicationContext ctx) {
		return (UserInforDAO) ctx.getBean("UserInforDAO");
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?