Get the App
SLTechnology News&Howtos  ›  Development  › 

How to apply iBATIS DAO framework

Shulou Source: shulou.com Published: 2022-06-02 03:23:33 10月05日 Update

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 >

Tags: Code application configuration that is interfaces content attributes frequent meetings skills files methods knowledge automatic generation support generation management conciseness brevity brevity things Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Shulou Technology MySQL Shulou Information Huawei