Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to apply iBATIS DAO framework

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you how to apply iBATIS DAO framework. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

The application of iBATIS DAO framework I.

Preparatory work

1. You can download http://apache.etoak.com/ibatis/binaries/ibatis.java/iBATIS_DAO-2.2.0.638.zip here

two。 First, write the DAO layer interface and the implementation class: the specific class method is omitted, mainly because the implementation class needs to inherit

Com.ibatis.dao.client.template.SqlMapDaoTemplate class

Java code

Package datamigrate; import datamigrate.TCommGuestbook0; import datamigrate.TCommGuestbook0Example; import java.util.List; public interface TCommGuestbook0DAO {int countByExample (TCommGuestbook0Example example);}

Java code

Package datamigrate; import com.ibatis.dao.client.DaoManager; import com.ibatis.dao.client.template.SqlMapDaoTemplate; import datamigrate.TCommGuestbook0; import datamigrate.TCommGuestbook0Example; import java.util.List; public class TCommGuestbook0DAOImpl extends SqlMapDaoTemplate implements TCommGuestbook0DAO {public TCommGuestbook0DAOImpl (DaoManager daoManager) {super (daoManager) Public int countByExample (TCommGuestbook0Example example) {Integer count = (Integer) queryForObject ("t_comm_guestbook_0.ibatorgenerated_countByExample", example); return count;}}

IBATIS DAO framework applications II.

Start the experience of iBATIS DAO framework

1. Configure dao.xml-The Configuration File (http://ibatis.apache.org/dtd/dao-2.dtd)

Xml code

< daoConfig >

Share To

Development

© 2024 shulou.com SLNews company. All rights reserved.

12
Report