sqlmapuserdao.java

来自「esri的ArcGIS Server超级学习模板程序(for java)」· Java 代码 · 共 59 行

JAVA
59
字号
package com.esri.solutions.jitk.personalization.dao;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.dao.DataAccessException;

/**
 * 
 * @author Susan Herdina
 * @version 1.0
 * @created 05-Nov-2007 10:29:29 AM
 * 
 * This class implements the IUserDAO and provides functionality to read and write User
 * Records to and from the database.
 *
 */
public class SqlMapUserDAO extends SqlMapClientDaoSupport implements IUserDAO {

	public void insert(UserRecord user)
			throws PersonalizationDAOException {
		try{
			user.setTimeModified(new java.sql.Timestamp(System.currentTimeMillis()));
			getSqlMapClientTemplate().insert("insertUser", user);	
		}
		catch(DataAccessException e){
			throw new PersonalizationDAOException( e );
		}		
	}

	public UserRecord selectOne(String id)
			throws PersonalizationDAOException {
		try{
			return (UserRecord)getSqlMapClientTemplate().queryForObject("selectOneUser", id);
		}
		catch(DataAccessException e){
			throw new PersonalizationDAOException( e );
		}
	}	

	public void update(UserRecord user)
			throws PersonalizationDAOException {
		try{
			user.setTimeModified(new java.sql.Timestamp(System.currentTimeMillis()));
			getSqlMapClientTemplate().update("updateUser", user);	
		}
		catch(DataAccessException e){
			throw new PersonalizationDAOException( e );
		}
	}
	
	public void delete(String id) throws PersonalizationDAOException {
		try{
			getSqlMapClientTemplate().delete("deleteUser", id);
		}
		catch(DataAccessException e){
			throw new PersonalizationDAOException( e );
		}
	}
}

⌨️ 快捷键说明

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