日期:2014-05-16  浏览次数:21140 次

spring+ibatis+mysql简单搭建

Ibatis2.3.4、spring2.0、mysql5.1、mysql-connect-java-5.0.4-bin.jar。

1、Mysql准备数据(use itcast数据库)

mysql>?create ?table ?student(id?int ?primary ?key ?auto_increment, firstname?varchar
(20), lastname?varchar (20));

2、准备POJO类

package ?cn.itcast;

public ?class ?Student?implements ?java.io.Serializable {
??private ?static ?final ?long ?serialVersionUID = 1L;
??private ?Integer id;
??private ?String firstname;
??private ?String lastname;

??public ?String getFirstname() {
????return ?firstname;
??}

??public ?void ?setFirstname(String firstname) {
????this .firstname = firstname;
??}

??public ?Integer getId() {
????return ?id;
??}

??