schemaexport:
[echo] 运行SchemaExport,利用 hbm.xml 文件生成数据表
.......
.......
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
BUILD FAILED
D:\Eclipse\Eclipse\workspace\SimpleChart\build.xml:88: Schema text failed: net.sf.hibernate.MappingException: duplicate import: DataSets
Total time: 2 seconds这个错误虽然自称duplicate import: DataSets,不过本座觉得完全不是类或者是hbm文件的问题(因为之前的项目中用过完全类似的模式)。打开Ant文件观察:
<?xml version="1.0" encoding="GBK"?>
<project name="JS" default="help" basedir=".">
....
....
<!-- ************************************************************** -->
<!-- SchemaExport 任务 -->
<!-- ************************************************************** -->
<target name="schemaexport">
<echo message="运行SchemaExport,利用 hbm.xml 文件生成数据表" />
<taskdef name="schemaexport" classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask" classpathref="project.class.path">
</taskdef>
<schemaexport config="${src.dir}/hibernate.cfg.xml" quiet="no" text="no" drop="no" output="schema-export.sql">
<fileset dir="src">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaexport>
</target>
</project>
把schemaExport任务中的fileset部分去掉后就万事大吉了。原因还不知道(很可能是hibernate的版本有些太古老了),不过报的错是非常的misleading,导致本座错过下半场前五分钟比赛。
update:瑞典果然在最后时刻破门得分,有些替巴尔德丝惋惜,不过更替瑞典高兴。为什么我在英格兰进球的时候,感觉正好相反。


2 Comments
Jump to comment form | comments rss [?] | trackback uri [?]