Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-27321

Add (EAP 8.0) documentation for working around JBEAP-27251 (Hibernate @Basic(fetch=LAZY) does not work by default)

XMLWordPrintable

    • Icon: Documentation Documentation
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 8.0.0.GA
    • None
    • None
    • False
    • None
    • False

      To be discussed further but the idea is to update the https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/8.0/html/migration_guide/application-migration-changes_default#migrating-from-hibernate-orm-5-6-to-6-0_default documentation to mention the workaround for JBEAP-27251.

      Background, as per https://docs.jboss.org/hibernate/orm/6.2/userguide/html_single/Hibernate_User_Guide.html#basic-basic-annotation

      "
      fetch - FetchType (defaults to EAGER)

      Defines whether this attribute should be fetched eagerly or lazily. EAGER indicates that the value will be fetched as part of loading the owner. LAZY values are fetched only when the value is accessed. Jakarta Persistence requires providers to support EAGER, while support for LAZY is optional meaning that a provider is free to not support it. Hibernate supports lazy loading of basic values as long as you are using its bytecode enhancement support.
      "
      And the linked content is https://docs.jboss.org/hibernate/orm/6.2/userguide/html_single/Hibernate_User_Guide.html#BytecodeEnhancement and more specifically https://docs.jboss.org/hibernate/orm/6.2/userguide/html_single/Hibernate_User_Guide.html#tooling-enhancement

      "
      Hibernate can also perform run-time bytecode enhancement when used in Jakarta EE compliant containers through jakarta.persistence.spi.ClassTransformer.
      "

      In EAP 8.0.x, applications can update their persistence units (persistence.xml) to include the following persistence unit hint to ensure that the "jakarta.persistence.spi.ClassTransformer" is activated to allow lazy loading of basic values:
      <property name="jboss.as.jpa.classtransformer" value="true" />

      In a future release, https://issues.redhat.com/browse/JBEAP-27251 will be addressed but the timeline for that is not yet known due to (Jakarta EE) compatibility concerns.

              Unassigned Unassigned
              smarlow1@redhat.com Scott Marlow
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: