1.首先要导好包,不然之后就是不停的该错
spring-4.0.3版本
aopalliance-1.0.jar
aspectjrt.jar
aspectjweaver.jar
commons-dbcp-1.2.1.jar
commons-logging-1.1.3.jar
commons-pool-1.6.jar
mysql-connector-java-5.0.8-bin.jar
spring-aop-4.0.3.RELEASE.jar
spring-aspects-4.0.3.RELEASE.jar
spring-beans-4.0.3.RELEASE.jar
spring-context-4.0.3.RELEASE.jar
spring-core-4.0.3.RELEASE.jar
spring-expression-4.0.3.RELEASE.jar
spring-jdbc-4.0.3.RELEASE.jar
spring-orm-4.0.3.RELEASE.jar
spring-tx-4.0.3.RELEASE.jar
spring-web-4.0.3.RELEASE.jar
hibernate-4.3.5版本
antlr-2.7.7.jar
dom4j-1.6.1.jar
hibernate-commons-annotations-4.0.4.Final.jar
hibernate-core-4.3.5.Final.jar
hibernate-jpa-2.1-api-1.0.0.Final.jar
jandex-1.1.0.Final.jar
javassist-3.18.1-GA.jar
jboss-logging-3.1.3.GA.jar
jboss-logging-annotations-1.2.0.Beta1.jar
jboss-transaction-api_1.2_spec-1.0.0.Final.jar
log4j-1.2.17.jar
2.实体类POJO
package com.sam.web.vo;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class Student {
private intsid;//学号
private String sname;//姓名
public Student() {
}
@Id
@GeneratedValue
public int getSid() {
return sid;
}
public void setSid(int sid) {
this.sid = sid;
}
public String getSname() {
return sname;
}
public void setSname(St