小弟菜鸟最近学习hibernate,测试oracle11g报异常,然而测试mysql5的时候正确没有异常,请高手指教,以下是测试代码
package cn;
import domain.User;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
public class TestHibernate {
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration().configure();
SessionFactory sf = conf.buildSessionFactory();
Session sess = sf.openSession();
Transaction tx = sess.beginTransaction();
User u = new User();
u.setId(10);
u.setUsername("elle");
u.setUserpass("cat");
sess.save(u);
tx.commit();
sess.close();
sf.close();
System.out.println("保存成功");
}
}
以下是相关的截图:
|
-
c.jpg
(25.79 KB, 下载次数: 0)
eclipse异常截图
-
b.jpg
(42.97 KB, 下载次数: 0)
程序截图
|