hibernate連的oracle數據庫測試junit報錯,請問是哪里錯了?

import?java.util.Date;
public?class?Students?{
private?int?sid;
private?String?sname;
private?String?gender;
private?Date?birthday;
private?String?address;
public?Students(){
}
????
public?Students(int?sid,?String?sname,?String?gender,?Date?birthday,?String?address)?{
//super();
this.sid?=?sid;
this.sname?=?sname;
this.gender?=?gender;
this.birthday?=?birthday;
this.address?=?address;
}
public?int?getSid()?{
return?sid;
}
public?void?setSid(int?sid)?{
this.sid?=?sid;
}
public?String?getSname()?{
return?sname;
}
public?void?setSname(String?sname)?{
this.sname?=?sname;
}
public?String?getGender()?{
return?gender;
}
public?void?setGender(String?gender)?{
this.gender?=?gender;
}
public?String?getAddress()?{
return?address;
}
public?void?setAddress(String?address)?{
this.address?=?address;
}
public?Date?getBirthday()?{
return?birthday;
}
public?void?setBirthday(Date?birthday)?{
this.birthday?=?birthday;
}
@Override
public?String?toString()?{
//?TODO?Auto-generated?method?stub
return?"Students?[sid="?+?sid?+",sname="+?sname?+?",?gender="
+?gender+",birthday?=?"+?birthday?+?",address?="?+?address?+"]";
}
}hibernate.cfg.xml如下:
<?xml?version="1.0"?encoding="UTF-8"?> <!DOCTYPE?hibernate-configuration?PUBLIC "-//Hibernate/Hibernate?Configuration?DTD?3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> ????<session-factory> ?????<property?name="connection.username">dbusrmkt</property> ?????<property?name="connection.password">futuremkt</property> ?????<property?name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property> ?????<property?name="connection.url">jdbc:oracle\:thin\:@172.17.11.60\:1521\:HDQTLS</property> ?????<property?name="dialect">org.hibernate.dialect.Oracle9Dialect</property> ????? ?????<property?name="show_sql">true</property> ?????<property?name="format_sql">true</property> ?????<property?name="hbm2ddl.auto">create</property> ?????<property?name="hibernate.default_schema">dbusrmkt</property> ????? ?????<mapping?resource="Students.hbm.xml"/> ????? ????</session-factory> </hibernate-configuration>
StudentsTest 測試類如下:
import?java.util.Date;
import?org.hibernate.Session;
import?org.hibernate.SessionFactory;
import?org.hibernate.Transaction;
import?org.hibernate.cfg.Configuration;
import?org.hibernate.service.ServiceRegistry;
import?org.hibernate.service.ServiceRegistryBuilder;
import?org.junit.After;
import?org.junit.Before;
import?org.junit.Test;
public?class?StudentsTest?{
private?SessionFactory?sessionFactory;
private?Session?session;
private?Transaction?transaction;
@Before
public?void?init()
{
//創建配置對象
Configuration?config?=?new?Configuration().configure();
//創建服務注冊對象
ServiceRegistry?serviceRegistry?=?new?ServiceRegistryBuilder().applySettings(config.getProperties()).buildServiceRegistry();
//創建會話工廠對象
sessionFactory?=?config.buildSessionFactory(serviceRegistry);
//會話對象
session?=?sessionFactory.openSession();
//開啟事務
transaction?=?session.beginTransaction();
}
@After
public?void?destory()
{
transaction.commit();//提交事務
session.close();//關閉會話
sessionFactory.close();//關閉會話工廠
}
@Test
public?void?testSaveStudents()
{
Students?s?=?new?Students(1,"張三","男",new?Date(),"武漢");
session.save(s);
}
}求教啊,謝謝!
2016-05-10
Failure Trace第一行顯示的是什么?