日期:2014-05-17 浏览次数:20978 次
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="person">
<typeAlias alias="phone" type="com.gogoosoft.entity.Person"/>
<select id="findAllPhone" resultClass="phone" remapResults="true">
SELECT * FROM person
</select>
</sqlMap>
package com.gogoosoft.dao.impl; import java.sql.SQLException; import java.util.ArrayList; import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport; import com.gogoosoft.dao.PersonDao; import com.gogoosoft.entity.Person; import com.ibatis.sqlmap.engine.impl.SqlMapClientImpl; import com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate; import com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl; public class PersonDaoImp extends SqlMapClientDaoSupport implements PersonDao{ public ArrayList<Person> getAll() throws SQLException { ArrayList<Person> list = null; list = (ArrayList<Person>) this.getSqlMapClientTemplate().queryForList("findAllPhone", null); return list; } }