日期:2014-05-16 浏览次数:20572 次
package org.ourpioneer.contact.bean; public class Contact { private Long id; private String name; private String gender; private String mobile; private String address; //省略getter和setter方法 @Override public String toString() { return "Contact [id=" + id + ", name=" + name + ", gender=" + gender + ", mobile=" + mobile + ", address=" + address + "]"; } }
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.14</version> <type>jar</type> <scope>compile</scope> </dependency>
CREATE TABLE `contact` ( `ID` int(11) NOT NULL AUTO_INCREMENT , `NAME` varchar(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL , `GENDER` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL , `MOBILE` varchar(11) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL , `ADDRESS` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL , PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARACTER SET=latin1 COLLATE=latin1_swedish_ci AUTO_INCREMENT=1 ROW_FORMAT=COMPACT ;
<repositories> <repository> <releases> <updatePolicy>always</updatePolicy> </releases> <snapshots> <updatePolicy>always</updatePolicy> </snapshots> <id>Jolbox</id> <name>Jolbox Repositories</name> <url>http://jolbox.com/bonecp/downloads/maven</url> </repository> </repositories>
<dependency> <groupId>com.jolbox</groupId> <artifactId>bonecp</artifactId> <version>0.7.1.RELEASE</version> </dependency>
<dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>1.0.0</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.0.0</version> <type>jar</type> <scope>compile</scope> </dependency>
<?xml version="1.0" encoding="UTF-8"?> <configuration> <jmxConfigurator /> <!--输出到控制台,方便调试,应用时切换到文件Log --> <appender name="ConsoleAppender" class="ch.qos.logback.core.ConsoleAppender"> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern>%date %-5level [%logger{80}:%L] - %msg