【问题标题】:Bytecode enhancement for Hibernate 5.3.7Hibernate 5.3.7 的字节码增强
【发布时间】:2020-11-08 16:45:54
【问题描述】:

我曾经在 Hibernate 4.x 中使用 ant 目标来检测我的类:

<target name="instrument" depends="compile">
        <taskdef name="enhance" classname="org.hibernate.tool.enhance.EnhancementTask">
            <classpath refid="extended.classpath"/>
            <classpath path="${classbin.dir}"/>
        </taskdef>

        <instrument verbose="true">
            <fileset dir="${TARGETROOT}/home/WEB-INF/classes">
                <include name="org/zfin/publication/Publication.class"/>
            </fileset>
        </instrument>
    </target>

但是当我升级到 Hibernate 5.3.7 时,这停止了工作。在蚂蚁中执行此操作的正确方法是什么?注意,我不使用 Maven。

我试过这个改变

    <target name="instrument" depends="compile">
        <taskdef name="enhance" classname="org.hibernate.tool.enhance.EnhancementTask">
            <classpath refid="extended.classpath"/>
            <classpath path="${classbin.dir}"/>
        </taskdef>

        <enhance base="${classbin.dir}" dir="${classbin.dir}/org/zfin/publication" failOnError="false" enableLazyInitialization="true"
                 enableDirtyTracking="false"
                 enableAssociationManagement="false"
                 enableExtendedEnhancement="false">
        </enhance>
    </target>

但它输出了 [增强] 无法增强类:Publication.class

表示它不工作。它增强了该目录中的一些类,但不是我需要的。

【问题讨论】:

标签: java hibernate byte-code-enhancement


【解决方案1】:

我发现 Hibernate 5.3.7 正在使用 byte-buddy 1.8.17。升级到 byte buddy 1.10.18 时,一切正常!

【讨论】:

    猜你喜欢
    • 2018-08-08
    • 2019-12-16
    • 2016-06-03
    • 1970-01-01
    • 1970-01-01
    • 2023-02-01
    • 2021-11-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多