openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Milosz Tylenda (JIRA)" <>
Subject [jira] Created: (OPENJPA-846) XML column support for MySQL
Date Sat, 27 Dec 2008 08:39:44 GMT
XML column support for MySQL

                 Key: OPENJPA-846
             Project: OpenJPA
          Issue Type: New Feature
          Components: sql
    Affects Versions: 2.0.0
         Environment: MySQL 5.1.30
            Reporter: Milosz Tylenda
         Attachments: OPENJPA-846.patch

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')

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. 

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message