Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M2
    • Fix Version/s: 1.3.0, 2.0.0-M2
    • Component/s: sql
    • Labels:
      None
    • Environment:
      MySQL 5.1.30

      Description

      1. The attached patch provides XML column support for MySQL.

      2. Reading the MySQL manual one can expect the minimum required MySQL
      version is 5.1.5 but I tested the patch only on version 5.1.30 - this is
      the first general availability version in the 5.1 series.

      3. ExtractValue MySQL function is used to do XML comparisons.
      TestXMLCustomerOrder.mysql file contains samples of SQL.
      Sample queries generated by the patched code:

      SELECT t0.oid, t1.oid FROM TORDER t0 CROSS JOIN TORDER t1 WHERE (ExtractValue(t0.shipAddress,'//City') = ExtractValue(t1.shipAddress,'//City')) ORDER BY t0.oid ASC
      SELECT t0.oid, t0.version, t0.amount, t0.CUSTOMER_COUNTRYCODE, t0.CUSTOMER_ID, t0.delivered, t0.shipAddress FROM TORDER t0 CROSS JOIN TCUSTOMER t1 WHERE (ExtractValue(t0.shipAddress,'/*/City') = t1.city)

      4. connectedConfiguration method is used to determine whether XML column is
      supported in the database.

      5. MySQL does not have a dedicated XML data type. They just added a couple of XML functions
      operating on string types. This requires a change in how Column.isXML() is implemented.
      The current version does:

      return _typeName != null && _typeName.startsWith("XML");

      Not surprisingly this fails while on MySQL. To remedy this I have added the
      "XML" property to Column and XMLValueHandler sets it to true. However,
      I also had to modify MappingInfo, otherwise this new property was
      losing its value. Let me know if there is a better solution for this.

      6. If the patch is going to be applied, I will provide an update for the
      manual too.

      7. I welcome comments and suggestions.

      1. OPENJPA-846.patch
        7 kB
        Milosz Tylenda

        Issue Links

          Activity

          Hide
          Milosz Tylenda added a comment -

          The patch is now attached.

          Show
          Milosz Tylenda added a comment - The patch is now attached.
          Hide
          Catalina Wei added a comment -

          Thanks to Milosz Tylenda,
          your patch has been committed at trunk r734601 and 1.3.x r734600.
          Please open a subtask of this issue or a new issue for OpenJPA Manual updates for Xmlmapping support for MySQL.

          Show
          Catalina Wei added a comment - Thanks to Milosz Tylenda, your patch has been committed at trunk r734601 and 1.3.x r734600. Please open a subtask of this issue or a new issue for OpenJPA Manual updates for Xmlmapping support for MySQL.
          Hide
          Michael Dick added a comment -

          Do we need additional test cases for this issue?

          Show
          Michael Dick added a comment - Do we need additional test cases for this issue?
          Hide
          Catalina Wei added a comment -

          No additional test cases are needed for MySQL database.

          Show
          Catalina Wei added a comment - No additional test cases are needed for MySQL database.

            People

            • Assignee:
              Unassigned
              Reporter:
              Milosz Tylenda
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development