猿问

初学java,配置hibernate的问题。

  1. hibernate.cfg.xml文件

  2. <?xml version="1.0" encoding="UTF-8"?>

  3. <!DOCTYPE hibernate-configuration PUBLIC

  4.         "-//Hibernate/Hibernate Configuration DTD 3.0//EN"

  5.         "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

  6. <hibernate-configuration>

  7. <session-factory>

  8. <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>

  9. <property name="connection.url">jdbc:oracle:thin:@localhost:1521:ZQDATA</property>

  10. <property name="connection.username">ZQ</property>

  11.          <property name="connection.password">1</property>

  12.  <property name="hibernate.show_sql">true</property> 

  13. <property name="hbm2ddl.auto">create</property>

  14. <mapping resource="/zqTwo/src/com/woders/hibernate.hbm.xml"/>  

  15. </session-factory>

  16. </hibernate-configuration>

错误:

2016-7-30 12:59:33 org.hibernate.Version logVersion

INFO: HHH000412: Hibernate Core {5.0.9.Final}

2016-7-30 12:59:33 org.hibernate.cfg.Environment <clinit>

INFO: HHH000206: hibernate.properties not found

2016-7-30 12:59:33 org.hibernate.cfg.Environment buildBytecodeProvider

INFO: HHH000021: Bytecode provider name : javassist

Exception in thread "main" org.hibernate.internal.util.config.ConfigurationException: Could not locate cfg.xml resource [hibernate.cfg.xml]

at org.hibernate.boot.cfgxml.internal.ConfigLoader.loadConfigXmlResource(ConfigLoader.java:53)

at org.hibernate.boot.registry.StandardServiceRegistryBuilder.configure(StandardServiceRegistryBuilder.java:163)

at org.hibernate.cfg.Configuration.configure(Configuration.java:259)

at org.hibernate.cfg.Configuration.configure(Configuration.java:245)

at com.woders.userTest.main(userTest.java:21)


夜夜我最爱
浏览 4408回答 1
1回答

呵呵呵呵加呵呵呵

没有读取到xml文件
随时随地看视频慕课网APP

相关分类

Java
我要回答