public class Test {
public static void main(String[] args) {
Student s=new Student();
s.setId(1);
s.setName("penglei");
s.setAge(25);
Configuration config=new Configuration().configure();
ServiceRegistry sr=new ServiceRegistryBuilder().applySettings(config.getProperties()).buildServiceRegistry();
SessionFactory sf=config.buildSessionFactory(sr);
Session session=sf.openSession();
session.beginTransaction();
session.save(s);
session.getTransaction().commit();
session.close();
sf.close();
}
}
2012-11-20 18:38:49 org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
2012-11-20 18:38:49 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.8.Final}
2012-11-20 18:38:49 org.hibernate.cfg.Environment <clinit>
INFO: HHH000205: Loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=org.h2.Driver, hibernate.dialect=org.hibernate.dialect.H2Dialect, hibernate.max_fetch_depth=5, hibernate.format_sql=true, hibernate.generate_statistics=true, hibernate.connection.username=sa, hibernate.connection.url=jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE, hibernate.bytecode.use_reflection_optimizer=false, hibernate.jdbc.batch_versioned_data=true, hibernate.connection.pool_size=5}
2012-11-20 18:38:49 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
2012-11-20 18:38:49 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
2012-11-20 18:38:49 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
2012-11-20 18:38:49 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: com/zzk/hibernate/model/Student.hbm.xml
2012-11-20 18:38:49 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
2012-11-20 18:38:49 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
Exception in thread "main" org.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver oracle.jdbc.driver.OracleDriver class not found
at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:107)
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:223)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:89)
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
详细解决方案
hibernate4.1.8 有关问题 雪中坐等
热度:28 发布时间:2016-04-22 00:17:34.0
相关解决方案
- 大家帮忙看一上 hibernate4.2加到web项目就报错,但是加到普通的java项目里有正常
- Hibernate4+Struts2的2.3版本+Spring3.1.2整合出现的小异常、
- struts2+hibernate4.1.4整合异常
- Hibernate4+spring3.1集成有关问题
- hibernate4.1.4最新源码现时在哪发布的呢
- Spring3.1.1 + Hibernate4.1.4 宣言事务配置不成功.
- hibernate4.0 org.hibernate.cach这个类,该怎么处理
- 【转】struts2+spring3+hibernate4+cxf2.7筹建webservice实例
- Hibernate4.1应用在WAS7上的事务有关问题
- struts2,hibernate4,spring3配置时有关问题汇总及解决方法
- Spring3+Hibernate4+SpringMVC调整Ext:JSON数据格式传输
- hibernate4,spring3,struts2调整中解决
- ssh调整例子(spring3 + struts2 + hibernate4+dwr+ext+json)
- spring3+hibernate4 有关问题
- Struts2.3+Spring3.2+hibernate4.2 Could not find action or result,该怎么处理
- Hibernate4 业务层没法更新记录
- ~ spring3.1+hibernate4.1.4 无法正常使用session
- ssh集成,项目启动报错(struts2.3.15.3+spring3.2.4+hibernate4.2.7.sp1),数据库oracle11g解决思路
- hibernate4.3.0中使用log4j时关于jar包取舍的有关问题
- Hibernate4.3.1 创建session工厂的有关问题
- hibernate4.3配置二级缓存报错了,该如何解决
- hibernate4.3连接SQLServer2012,配置正常,但无法打开数据库,同时爆出连接错误
- hibernate4.3连接MySQL6.0,配置正常,但无法打开数据库,同时爆出连接错误
- hibernate4.3.4.final出现的一个有关问题
- 程序升级替spring4+hibernate4+struts2以后,不识别DelegatingRequestProcessor了
- 大神求解,hibernate4.2.1的一个HelloWorld例证配置搞了两天
- hibernate4 实现 自动更新表结构,该怎么解决
- hibernate4.0+spring3.1+struts2.2.3集成有关问题
- hibernate4.0+spring3.1+struts2.2.3集成无法访问数据库解决思路
- hibernate4.1 下载完后,源码在哪个目录下解决思路