csdn下载里搜索一下ibatis就可以了,一堆的项目
解决方案 »
- CXF疑问
- 关于guid 超级难 !!!!!!!!!!!!!
- hibernate 请今年 关于hibernate 两个数据库 之间表的关联问题
- socket连接问题
- dom4j怎么创建一个Element
- 我的程序报这样的错,请问该怎么解决啊?
- 在编写javabean时,那它自动生成setXXX()和getXXX()方法?
- ■■请教这段JAVA代码是什么意思,是struts中的,如下■■
- 请教 ejb 的 home interface & remote interface各有什么作用? 理解不了呀
- eclipse4.6和JDK1.6的兼容性
- struts2支持配置文件的动态更新 不用重启服务器 不知道最新版本的spring和hibernate里有没有类似的功能 高分悬赏
- Invalid path /jsps/post was requested
<sqlMap namespace="User">
<select id="checkExistByEmail" resultClass="Integer" parameterMap="HashMap">
select count(user)
from <include refid="user_table"/>
where email = #value# and password =#password#
</select>
</sqlMap>config:
<!-- START iBATIS config -->
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- this needs to point to where the sql-map-config.xml file is -->
<property name="configLocation" value="classpath:sql-map-config.xml" />
</bean>
<bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate">
<property name="sqlMapClient" ref="sqlMapClient" />
</bean>
<!-- END iBATIS config -->userDaoImpl:
public Integer checkExistByEmail(String email, String password) throws DataAccessException {
Map<String,Object> cond = new HashMap<String,Object>();
cond.put("email", email);
cond.put("password", password);
return (Integer) sqlMapClientTemplate.queryForObject("checkExistByEmail", cond );
}userServiceImpl:
if(userDao.checkExistByEmail(email, password)==1){
//如果用户存在则……
}else{
//不存在……
}