hbm2ddl不适用于hibernate-tool 4中的审计表

时间:2015-04-07 17:44:20

标签: hibernate-envers hbm2ddl hibernate-tools

我在我的应用程序中使用了hibernate 4.2.0.Final和hibernate工具4.0.0-CR1。

我正在尝试执行ant任务hibernatetool从实体注释生成ddl语句,它适用于普通表,但是对于审计表,它不生成ddl语句,虽然我使用“org.hibernate.tool.ant.EnversHibernateToolTask​​”

以下是我的maven脚本代码段:

<dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-tools</artifactId>
        <scope>compile</scope>
        <version>4.0.0-CR1</version>
        <exclusions>
            <exclusion>
                <groupId>org.eclipse</groupId>
                <artifactId>text</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.eclipse.core</groupId>
                <artifactId>runtime</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.2.0.Final</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.2.0.Final</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-envers</artifactId>
        <version>4.2.0.Final</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.8</version>
            <executions>
                <execution>
                    <id>compile</id>
                    <phase>compile</phase>
                    <configuration>
                        <target name="clean">
                            <echo
                                message="Target callled for cleaning the file through maven antrun-plugin" />
                            <delete file="${project.basedir}/schema/baseline/new_schema.sql" />
                        </target>
                        <target name="execute">
                            <echo message="Ant target, through maven-antrun-plugin, started" />
                            <property name="maven_compile_classpath" refid="maven.compile.classpath" />
                            <path id="hibernatetool.path">
                                <pathelement path="${maven_compile_classpath}" />
                            </path>
                            <taskdef name="hibernatetool"
                                classname="org.hibernate.tool.ant.EnversHibernateToolTask"
                                classpathref="hibernatetool.path" />
                            <hibernatetool destdir="${project.basedir}/schema/baseline/">
                                <jpaconfiguration persistenceunit="testunit" />
                                <hbm2ddl export="false" drop="false" create="true" outputfilename="new_schema.sql"
                                    format="true" />
                            </hibernatetool>
                            <echo message="Ant target, through maven-antrun-plugin, terminated" />
                        </target>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
    <pluginManagement>

我正在寻找hibernate-tools 3的帮助,但对于hibernate-tools 4我找不到足够的帮助。

0 个答案:

没有答案