Hibernate - Difference between bytecode instrumentation and bytecode enhancement?

后端 未结 1 801
离开以前
离开以前 2020-12-24 13:01

I am using Hibernate 4.2 and build time bytecode instrumentation for solve the lazy issue that appears on a @OneToOne relation and @Lob (https://de

1条回答
  •  -上瘾入骨i
    2020-12-24 13:39

    The answer is the way byte code enhancement is done. Let's see what happen in both cases

    1. Bytecode instrumentation: Adding bytecode to a Java class during “run time.” It's not really during run time, but more during “load” time of the Java class. Further you can read this post in detail.

    And

    1. Bytecode enhancement: Bytecode enhancement may be performed either at runtime or at build time (offline). When enhancement is performed at runtime, persistent classes are enhanced as they are loaded. When enhancement is performed offline, class files are enhanced during a post-compilation step;

      In most case of bytecode enhancement, they are done at post compilation. If this is the case with your Hibernate bytecode enhancement, then yes the obvious choice to change the code is the byte code instrumentation.

    0 讨论(0)
提交回复
热议问题