报错:部分错误信息,主要查看CauseBy
Caused by: org.hibernate.InvalidMappingException: Unable to read XML
at org.hibernate.internal.util.xml.MappingReader.legacyReadMappingDocument(MappingReader.java:375)
at org.hibernate.internal.util.xml.MappingReader.readMappingDocument(MappingReader.java:304)
at org.hibernate.cfg.Configuration.add(Configuration.java:518)
at org.hibernate.cfg.Configuration.add(Configuration.java:514)
at org.hibernate.cfg.Configuration.add(Configuration.java:688)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:726)
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:363)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
... 57 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 32; 元素类型为 "key" 的内容必须匹配 "(column)*"。
错误原因:xml多对一key指定错误
错误写法
正确写法
必须指定column属性,而直接在标签内写是错误的。