亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

靜態初始化異常 。 很無奈 下面日志

十二月 22, 2016 9:29:06 下午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>

INFO: HCANN000001: Hibernate Commons Annotations {4.0.4.Final}

十二月 22, 2016 9:29:06 下午 org.hibernate.Version logVersion

INFO: HHH000412: Hibernate Core {4.3.0.Final}

十二月 22, 2016 9:29:06 下午 org.hibernate.cfg.Environment <clinit>

INFO: HHH000206: hibernate.properties not found

十二月 22, 2016 9:29:06 下午 org.hibernate.cfg.Environment buildBytecodeProvider

INFO: HHH000021: Bytecode provider name : javassist

十二月 22, 2016 9:29:06 下午 org.hibernate.cfg.Configuration configure

INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml

十二月 22, 2016 9:29:06 下午 org.hibernate.cfg.Configuration getConfigurationInputStream

INFO: HHH000040: Configuration resource: /hibernate.cfg.xml

十二月 22, 2016 9:29:06 下午 org.hibernate.cfg.Configuration addResource

INFO: HHH000221: Reading mappings from resource: com/xn/entity/Grade.hbm.xml

十二月 22, 2016 9:29:06 下午 org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity

WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!

十二月 22, 2016 9:29:06 下午 org.hibernate.cfg.Configuration addResource

INFO: HHH000221: Reading mappings from resource: com/xn/entity/Student.hbm.xml

十二月 22, 2016 9:29:06 下午 org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity

WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!

十二月 22, 2016 9:29:06 下午 org.hibernate.cfg.Configuration doConfigure

INFO: HHH000041: Configured SessionFactory: null

十二月 22, 2016 9:29:06 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)

十二月 22, 2016 9:29:07 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator

INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/sgu?useUnicode=true&characterEncoding=utf8]

十二月 22, 2016 9:29:07 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator

INFO: HHH000046: Connection properties: {user=root, password=****}

十二月 22, 2016 9:29:07 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator

INFO: HHH000006: Autocommit mode: false

十二月 22, 2016 9:29:07 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000115: Hibernate connection pool size: 20 (min=1)

十二月 22, 2016 9:29:07 下午 org.hibernate.dialect.Dialect <init>

INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect

Exception in thread "main" java.lang.ExceptionInInitializerError

at com.xn.entity.test.add(test.java:25)

at com.xn.entity.test.main(test.java:13)

Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/xn/entity/Student.hbm.xml

at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3736)

at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXmlQueue(Configuration.java:3725)

at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3713)

at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1410)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1844)

at com.xn.util.hibernateUtil.<clinit>(hibernateUtil.java:19)

... 2 more

Caused by: org.hibernate.MappingException: column attribute may not be used together with <column> subelement

at org.hibernate.cfg.HbmBinder.bindColumns(HbmBinder.java:1117)

at org.hibernate.cfg.HbmBinder.bindColumnsOrFormula(HbmBinder.java:1627)

at org.hibernate.cfg.HbmBinder.bindSimpleValue(HbmBinder.java:1193)

at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:443)

at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:386)

at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:326)

at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:177)

at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3733)

... 7 more


正在回答

2 回答

并沒發現什么錯啊。。

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"

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

<!-- Generated 2016-12-22 20:01:40 by Hibernate Tools 3.5.0.Final -->

<hibernate-mapping>

? ? <class name="com.xn.entity.Student" table="student">

? ? ? ? <id name="sid" type="java.lang.Integer" column="sid" >

? ? ? ? ? ? <column name="sid" />

? ? ? ? ? ? <generator class="increment"></generator>

? ? ? ? </id>

? ? ? ? <property name="sname" type="java.lang.String">

? ? ? ? ? ? <column name="sname" />

? ? ? ? </property>

? ? ? ? <property name="sex" type="java.lang.String">

? ? ? ? ? ? <column name="sex" />

? ? ? ? </property>

? ? </class>

</hibernate-mapping>


0 回復 有任何疑惑可以回復我~
#1

慕粉3796571

主鍵配置錯誤
2017-06-15 回復 有任何疑惑可以回復我~

恩,Student.hbm.xml這個文件內容有問題,不能解析和映射,

你在Student.hbm.xml文件里里的內容找找看哪里內容寫錯了

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
Hibernate初探之一對多映射
  • 參與學習       42163    人
  • 解答問題       310    個

Hibernate中一對多關聯映射配置,以及cascade和inverse屬性作用

進入課程

靜態初始化異常 。 很無奈 下面日志

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號