为什么我用hbm2dll生成的sql脚本里没有内容。在cmd下提示是成功了
build.xml配置如下:<target name="schema1" depends="compile">
  <taskdef name="schemaexportTask"
       classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
   classpathref="project.class.path"/>
<schemaexportTask 
properties="${class.root}/hibernate.cfg.xml"
output="${schema.dir}/sampledb.sql"
quiet="true"
        text="true"
        drop="true"
        create="true"
        delimiter=";">
</schemaexportTask>
</target>

解决方案 »

  1.   

    hibernate配置文件中有没有配置hibernate.dialect属性?
      

  2.   

    build.xml
    hibernate的不是hibernate.cfg.xml么
    要把这个hbm2dll属性设为true
      

  3.   

    <taskdef name="hibernatetool"
                 classname="org.hibernate.tool.ant.HibernateToolTask"
                 classpathref="project.classpath"/>
        
        <target name="schemaexport">
            <hibernatetool destdir="${basedir}">
                <classpath path="${build.dir}"/>
                <configuration 
                   configurationfile="${build.dir}/hibernate.cfg.xml"/>
                <hbm2ddl
                   drop="true"
                   create="true"
                   export="true"
                   outputfilename="helloworld-dll.sql"
                   delimiter=";"
                   format="true"/>
            </hibernatetool>
        </target>   
    试试这个
      

  4.   

    原来的我之前的配置中outputfilename写成了outputFileName="${schema.dir}/sampledb.sql",改成了outputFileName="sampledb.sql"就可以了。