Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-17881

Fix Jakarta EE 10 TCK jpa/core test failures (related to Byte[]/Character[] mapping changes in ORM 6.2)

XMLWordPrintable

    • ---
    • ---

      Refer to https://docs.jboss.org/hibernate/orm/6.2/migration-guide/migration-guide.html#byte-and-character-array-mapping-changes for an explanation of why we are seeing the test failures with our current out of the box WildFly configuration settings which include settings specified (or not specified) by WildFly Persistence container/Hibernate integration layer.

      jpa_core_annotations has 150 failures
      jpa_core_criteriaapi_CriteriaQuery has 228 failures
      jpa_core_entitytest has 60 failures
      jpa_core_types has 84 failures

      Example of the deployment error that causes 522 (Jakarta EE 10 Platform) TCK test failures:

      Caused by: org.hibernate.MappingException: The property com.sun.ts.tests.jpa.core.annotations.access.property.DataTypes#charArrayData uses a wrapper type Byte[]/Character[] which indicates an issue in your domain model. These types have been treated like byte[]/char[] until Hibernate 6.2 which meant that null elements were not allowed, but on JDBC were processed like VARBINARY or VARCHAR. If you don't use nulls in your arrays, change the type of the property to byte[]/char[]. To allow explicit uses of the wrapper types Byte[]/Character[] which allows null element but has a different serialization format than before Hibernate 6.2, configure the setting hibernate.type.wrapper_array_handling to the value ALLOW. To revert to the legacy treatment of these types, configure the value to LEGACY. For more information on this matter, consult the migration guide of Hibernate 6.2 and the Javadoc of the org.hibernate.cfg.AvailableSettings.WRAPPER_ARRAY_HANDLING field."

      The workaround for this failure is to update the persistence unit definition to set "hibernate.type.wrapper_array_handling" to "legacy" or https://docs.jboss.org/hibernate/orm/6.2/javadocs/org/hibernate/type/WrapperArrayHandling.html#LEGACY.

      If the application database supports "SQL Array" column type, you could update the database to use an array type (e.g. follow advice in migration guide).

      Another workaround as mentioned in migration guide is to update the application code (e.g. https://github.com/jakartaee/platform-tck/blob/10.0.x/src/com/sun/ts/tests/jpa/core/annotations/access/property/DataTypes.java#L59) from:

      private Character[] charArrayData;
      

      To:

      private char[] charArrayData;    
      

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

                Created:
                Updated:
                Resolved: