hbm2ddl生成ddl sql脚本有关问题
hbm2ddl生成ddl sql脚本问题为什么我用hbm2dll生成的sql脚本里没有内容。在cmd下提示是成功了build.xml配置
hbm2ddl生成ddl sql脚本问题
为什么我用hbm2dll生成的sql脚本里没有内容。在cmd下提示是成功了
build.xml配置如下:
XML code<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>
[解决办法]hibernate配置文件中有没有配置hibernate.dialect属性?
[解决办法]build.xml
hibernate的不是hibernate.cfg.xml么
要把这个hbm2dll属性设为true
[解决办法]<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>
试试这个