首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

hbm2ddl生成ddl sql脚本有关问题

2012-08-30 
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>
试试这个

热点排行