Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-846

XML column support for MySQL

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0-M2
    • 1.3.0, 2.0.0-M2
    • sql
    • None
    • 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.

      Attachments

        1. OPENJPA-846.patch
          7 kB
          Milosz Tylenda

        Issue Links

          There are no Sub-Tasks for this issue.

          Activity

            People

              Unassigned Unassigned
              milosz Milosz Tylenda
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: