摘要: org.hibernate.HibernateException: No CurrentSessionContext configured!at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:881)at com.hibernate.model.StudentTest.testSession(StudentTest.java:40)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.ref 阅读全文
posted @ 2012-04-20 17:31 慢吞吞 阅读(2231) 评论(0) 推荐(0) 编辑
摘要: getCurrentSession() 先查找环境中有没有session, 有的话直接拿着用,没有的话创建一个新的session, 用commit提交 自动close(在commit提交之前用getcurrentsession得到的所有session都是同一个)用途:界定事务边界OpenSession() 永远是创建一个新的session, 要手动close关闭 阅读全文
posted @ 2012-04-20 16:06 慢吞吞 阅读(195) 评论(0) 推荐(0) 编辑
摘要: Exception in thread "main" java.lang.AbstractMethodError: oracle.jdbc.driver.OracleDatabaseMetaData.supportsGetGeneratedKeys()Zat org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:142)at org.hibernate.service.internal.StandardServiceRegistryImpl.configureS 阅读全文
posted @ 2012-04-20 11:03 慢吞吞 阅读(9203) 评论(0) 推荐(0) 编辑
摘要: mysql: Class.forName("com.mysql.jdbc.Driver").newInstance();Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/homework?user=root&password=123456");Statement sm = conn.createStatement();sm.executeUpdate("insert into employee(name,sex,dept,tel) VALUES(& 阅读全文
posted @ 2012-04-20 10:42 慢吞吞 阅读(311) 评论(0) 推荐(0) 编辑