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

Buildfile: E:\workspace\Projects\hibernatetool\build.xml
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)
[hibernatetool] 2010-4-22 14:09:11 org.hibernate.cfg.Environment <clinit>
[hibernatetool] 信息: Hibernate 3.2.5
[hibernatetool] 2010-4-22 14:09:11 org.hibernate.cfg.Environment <clinit>
[hibernatetool] 信息: hibernate.properties not found
[hibernatetool] 2010-4-22 14:09:11 org.hibernate.cfg.Environment buildBytecodeProvider
[hibernatetool] 信息: Bytecode provider name : cglib
[hibernatetool] 2010-4-22 14:09:11 org.hibernate.cfg.Environment <clinit>
[hibernatetool] 信息: using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] 2010-4-22 14:09:12 org.hibernate.cfg.Configuration configure
[hibernatetool] 信息: configuring from file: hibernate.cfg.xml
[hibernatetool] 2010-4-22 14:09:12 org.hibernate.cfg.Configuration addResource
[hibernatetool] 信息: Reading mappings from resource : DocumentCatalog.hbm.xml
[hibernatetool] 2010-4-22 14:09:12 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
[hibernatetool] 信息: Mapping class: com.bigbuddy.oa.bean.DocumentCatalog -> documentCatalog
[hibernatetool] An exception occurred while running exporter #2:hbm2java (Generates a set of .java files)
[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] org.hibernate.InvalidMappingException: Could not parse mapping document from resource DocumentCatalog.hbm.xml
[hibernatetool] org.hibernate.MappingException: class com.bigbuddy.oa.bean.DocumentCatalog not found while looking for property: flag
[hibernatetool] java.lang.ClassNotFoundException: com.bigbuddy.oa.bean.DocumentCatalog
[hibernatetool] A class were not found in the classpath of the Ant task.
[hibernatetool] Ensure that the classpath contains the classes needed for Hibernate and your code are in the classpath.

BUILD FAILED
E:\workspace\Projects\hibernatetool\build.xml:17: org.hibernate.InvalidMappingException: Could not parse mapping document from resource DocumentCatalog.hbm.xml

Total time: 764 milliseconds

 异常信息如上。

原因为:

HBM文件中的属性没有声明type类型,这种HBM文件在已经写好javaBean后再由HBM生成Shema时是没有问题的,因为它可以通过javaBean来得到相应的类型,但是,如果想从HBM中生成javaBean如果不指定类型就不可以了。

在hbm中加入属性的type后成功解决,根据相应的hbm和数据库表生成javaBean

 

 

参考:http://lisong0624.blog.163.com/blog/static/1887198620103202522410/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值