Uploaded image for project: 'Hibernate ORM'
  1. HHH-10531

JaxbHbmTuplizerType marshalling does not conform hibernate-mapping-4.0.xsd

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 5.0.7, 5.1.0
    • Fix Version/s: 5.2.2
    • Component/s: hibernate-core
    • Labels:
      None
    • Suitable for new contributors:
      Yes, likely
    • Last commented by a user?:
      true
    • Sprint:

      Description

      Problem description

      Marshalling a JaxbHbmTuplizerType to Xml :

      • Does not take into account the entity mode attribute may be null whereas the xml-schema does not specifies it as use="required" (a NPE is thrown).
      • Does not serialize the entity mode properly. The Enum litteral is inserted (POJO, MAP) instead of the xsd-specified values ("pojo", "dynamic-map"). Creating a session factory with the generated Xml throws a org.hibernate.boot.InvalidMappingException.

      As a consequences, the xml cannot be generated or the generated xml does not define a valid mapping file.

      Steps to reproduce

      See attached file.

      Workaround

      The first problem (NPE) may be avoided specifying explicitly the entity mode but the generated xml still cannot be added to a Configuration.

      Fix

      org.hibernate.boot.jaxb.hbm.internal.EntityModeConverter.toXml(EntityMode) should return entityMode.getExternalName() instead of entityMode.name() and handle a potentially null argument.

      Edit

      • Updated test case
      • provide patch for fix.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: