当我试图启动Hibernate时,我得到了这个错误。我是一个冬眠新手,所以希望有人能指出我在CFG上犯的错误。我包括了这个错误,希望它是一个简单的修复,谢谢。
<?xml version='1.0' encoding='utf-8'?>
<!-- Database connection settings -->
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:orcl"</property>
<property name="connection.username">scott</property>
<property name="connection.password">tiger</property>
<property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
</session-factory>
Exception in thread "main" org.hibernate.MappingException: invalid configuration
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2241)
at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:230)
at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:71)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2158)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:212)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:71)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2137)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:206)
at HibernateContext.setConfiguration(HibernateContext.java:20)
at HibernateContext.addClass(HibernateContext.java:205)
at HibernateContext.addClasses(HibernateContext.java:216)
at main.main(main.java:8)
由:org.xml.sax.SaxParseException引起;亚麻编号:14;专栏编号:89;必须为元素类型“property”声明属性“value”。在com.sun.org.apache.xerces.internal.util.errorHandlerWrapper.createsAXParseException(未知来源)在xerces.internal.impl.dtd.xmldtdvalidator.adddtdefaultAttrsandValidate(未知来源)com.sun.org.apache.xerces.internal.impl.dtd.xmldtdValidator.handleStartElement(未知来源)com.sun.org.apache.xerces.internal.impl.dtd.xmldtdValidator.handleStartElement(未知来源)在com.sun.org.apache.xerces.in Impl$fragmentcontentdriver.next(来源未知)Ternal.impl.xmldocumentscannerimpl.next(未知来源)位于com.sun.org.apache.xerces.internal.impl.xmlnsdocumentscannerimpl.next(未知来源)位于com.sun.org.apache.xerces.internal.xmldocumentscannerimpl.next(未知来源)位于com.sun.org.apache.xerces.internal.xmldocumentfragmentscannerimpl.scandocument(未知来源)位于(未知来源)位于com.sun.org.apache.xerces.internal.parsers.abstractsaxparser.parse(未知来源)位于com.sun.org.apache.xerces.internal.jaxp.saxparserImpl$jaxpsaxparser.parse(未知来源)位于org.dom4j.io.saxreader.read(saxreader.java:465)位于org.hibernate.cfg.configuration.doconfigure(configuration.java:2238)...11
尝试使用
作为新手,您可以在http://www.hibernate.org/docs阅读整个hibernate文档