日期:2014-05-16 浏览次数:20680 次
package com.ego.springjdbc.vo; import java.io.Serializable; import java.sql.Date; public class People implements Serializable{ private int id; private String name; private Date birthDay; private Boolean sex; private Double weight; private float height; public People(){ } public People(int id, String name, Date birthDay, Boolean sex, Double weight, float height) { super(); this.id = id; this.name = name; this.birthDay = birthDay; this.sex = sex; this.weight = weight; this.height = height; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Date getBirthDay() { return birthDay; } public void setBirthDay(Date birthDay) { this.birthDay = birthDay; } public Boolean getSex() { return sex; } public void setSex(Boolean sex) { this.sex = sex; } public Double getWeight() { return weight; } public void setWeight(Double weight) { this.weight = weight; } public float getHeight() { return height; } public void setHeight(float height) { this.height = height; } @Override public String toString() { return "People [birthDay=" + birthDay + ", height=" + height + ", id=" + id + ", name=" + name + ", sex=" + sex + ", weight=" + weight + "]"; } }
#MySql数据库连接参数配置 driver=com.mysql.jdbc.Driver url=jdbc:mysql://127.0.0.1:3306/testibatis username=root password=111111
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <value>classpath:database.properties</value> </property> </bean> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="${driver}"/> <property name="url" value="${url}"/> <property name="username" value="${username}"/> <property name="password" value="${password}"/> </bean> <!-- <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> </bean> --> <bean id="peopleDaoImpl" class="com.ego.springjdbc.dao.impl.PeopleDaoImpl"> <property name="dataSource" ref="dataS