mas_china 2013-05-01 12:07 采纳率: 0%
浏览 276

org.hibernate.InvalidMappingException: Could not parse mapping document from

照网上方法,试了很多,但仍解决不了。

=========================================================================================================

12:01:14,672  INFO Version:37 - HCANN000001: Hibernate Commons Annotations {4.0.1.Final}

12:01:14,721  INFO Version:41 - HHH000412: Hibernate Core {4.1.10.Final}

12:01:14,731  INFO Environment:239 - HHH000206: hibernate.properties not found

12:01:14,734  INFO Environment:342 - HHH000021: Bytecode provider name : javassist

12:01:14,783  INFO Configuration:1926 - HHH000043: Configuring from resource: /hibernate.cfg.xml

12:01:14,784  INFO Configuration:1945 - HHH000040: Configuration resource: /hibernate.cfg.xml

12:01:15,199  INFO Configuration:718 - HHH000221: Reading mappings from resource: cn/jhost/alibaba/user/vo/UserModel.hbm.xml

12:01:15,522  INFO Configuration:2067 - HHH000041: Configured SessionFactory: null

org.hibernate.InvalidMappingException: Could not parse mapping document from resource cn/jhost/alibaba/user/vo/UserModel.hbm.xml

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

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

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

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

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

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

at cn.jhost.alibaba.common.HibernateUtil.<clinit>(HibernateUtil.java:13)

at cn.jhost.alibaba.user.dao.Impl.H4Impl.getByCondition(H4Impl.java:68)

at cn.jhost.alibaba.user.dao.Impl.H4Impl.getByCondition(H4Impl.java:1)

at cn.jhost.alibaba.user.business.ebo.UserEbo.getByCondition(UserEbo.java:22)

at cn.jhost.alibaba.user.business.ebo.UserEbo.getByCondition(UserEbo.java:1)

at cn.jhost.alibaba.user.business.factory.UserEbiFactory.main(UserEbiFactory.java:20)

Caused by: org.hibernate.PropertyNotFoundException: field [password] not found on cn.jhost.alibaba.user.vo.UserModel

at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:182)

at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:174)

at org.hibernate.property.DirectPropertyAccessor.getGetter(DirectPropertyAccessor.java:197)

at org.hibernate.internal.util.ReflectHelper.getter(ReflectHelper.java:253)

at org.hibernate.internal.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:229)

at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:324)

at org.hibernate.cfg.HbmBinder.createProperty(HbmBinder.java:2311)

at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2276)

at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2166)

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

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

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

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

... 11 more

Exception in thread "main" java.lang.NullPointerException

at cn.jhost.alibaba.common.HibernateUtil.currentSession(HibernateUtil.java:26)

at cn.jhost.alibaba.user.dao.Impl.H4Impl.getByCondition(H4Impl.java:68)

at cn.jhost.alibaba.user.dao.Impl.H4Impl.getByCondition(H4Impl.java:1)

at cn.jhost.alibaba.user.business.ebo.UserEbo.getByCondition(UserEbo.java:22)

at cn.jhost.alibaba.user.business.ebo.UserEbo.getByCondition(UserEbo.java:1)

at cn.jhost.alibaba.user.business.factory.UserEbiFactory.main(UserEbiFactory.java:20)

===============================================================================================

<?xml version="1.0" encoding='utf-8'?>

<!DOCTYPE hibernate-mapping PUBLIC 

"-//Hibernate/Hibernate Mapping DTD 3.0//EN"

"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

 

<hibernate-mapping>

 

    <class name="cn.jhost.alibaba.user.vo.UserModel" table="tbl_user"  dynamic-insert="true" dynamic-update="true" optimistic-lock="version">

    <id name="uuid">

    <generator class="uuid"/>

    </id>

    <version name="version" column="version"/>

    <property name="name" column="name" />

    <property name="password" column="password"/>

<property name="type" column="type"/>

 

</class>

 

</hibernate-mapping>

====================================================================================

<?xml version='1.0' encoding='utf-8'?>

<!DOCTYPE hibernate-configuration PUBLIC

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

"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

 

<hibernate-configuration>

 

    <session-factory>

 

        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>

        <property name="connection.url">jdbc:mysql://localhost:3306/alibaba?useUnicode=true&amp;characterEncoding=UTF-8</property>

        <property name="connection.username">root</property>

        <property name="connection.password">123456</property>

 

<property name="c3p0.min_size">5</property>

        <property name="c3p0.max_size">20</property>

        <property name="c3p0.timeout">180</property>

        <property name="c3p0.max_statements">5</property>

        

        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>

 

        <!-- Enable Hibernate's automatic session context management -->

        <property name="current_session_context_class">thread</property>

 

        <property name="show_sql">true</property>

<property name="format_sql">true</property>

 

 

        <mapping resource="cn/jhost/alibaba/user/vo/UserModel.hbm.xml"/>

 

    </session-factory>

 

</hibernate-configuration>

  • 写回答

1条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2022-10-28 03:59
    关注
    不知道你这个问题是否已经解决, 如果还没有解决的话:

    如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^
    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?