Hibernate错误求解
hibernate.cfg.xml内容如下
XML code
<?xml version='1.0' encoding='utf-8'?>
<hibernate-configuration
xmlns="http://www.hibernate.org/xsd/hibernate-configuration"
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-configuration hibernate-configuration-4.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="connection.url">jdbc:sqlserver://localhost:1433;DatabaseName=stu_sys</property>
<property name="connection.username">sa</property>
<property name="connection.password">123456</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.SQLServer2005Dialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">update</property>
<mapping resource="DAO/grade.hbm.xml"/>
</session-factory>
</hibernate-configuration>
控制台显示的错误:
2012-5-1 16:58:48 org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
2012-5-1 16:58:48 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.2.Final}
2012-5-1 16:58:48 org.hibernate.cfg.Environment <clinit>
INFO: HHH000205: Loaded properties from resource hibernate.properties: {hibernate.c3p0.timeout=1800, hibernate.connection.driver_class=com.microsoft.sqlserver.jdbc.SQLServerDriver, hibernate.c3p0.max_statements=50, hibernate.dialect=org.hibernate.dialect.SQLServer2005Dialect, hibernate.c3p0.max_size=20, hibernate.c3p0.min_size=5, hibernate.connection.username=sa, hibernate.connection.url=jdbc:sqlserver://localhost:1433;DatabaseName=stu_sys, hibernate.bytecode.use_reflection_optimizer=false, hibernate.connection.password=****}
2012-5-1 16:58:48 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
2012-5-1 16:58:48 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
2012-5-1 16:58:48 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
Exception in thread "main"
org.hibernate.MappingException: invalid configuration
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2009)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1926)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1905)
at DAO.gradeManager.main(gradeManager.java:18)
Caused by:
org.xml.sax.SAXParseException: Document i