glassfish
  1. glassfish
  2. GLASSFISH-1719

Support Mapping Oracle XMLType in Essentials

    Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 9.1pe
    • Fix Version/s: not determined
    • Component/s: entity-persistence
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      1,719

      Description

      XMLType is a special type on Oracle databases that allows you to store XML
      documents and perform special queries on them.

      Retreiving XMLType from the database requires some special code because it the
      JDBC driver returns an object of type oracle.sql.OPAQUE and that type requires
      a live connection in order to be translated to an XMLType. The point where
      TopLink currently access the type is too late for that connection to be
      guaranteed available.

      We should support this kind of type.

      • Allow the user to map their XML Documents to an XMLType field in an Oracle
        database
      • Generate appropriate INSERT and UPDATE SQL statements
      • Provide support for querying based on the XMLType field.

      The following operators should be supported:

      extract – extract takes an xpath expression and returns another XMLType which
      corresponds to some piece of the original document that matches the xpath
      expression. (see above example)

      extractValue – like extract, takes an xpath expression but returns either a
      string or numerical value based on the contents of the nodes returned by the
      xpath expression. eg
      SELECT * FROM EMPLOYEE WHERE extractValue(RESUME, ‘//education/school/text()’)
      = ‘Carleton’

      existsNode – takes an xpath expression and returns the number of nodes which
      match the expression. eg
      SELECT * FROM EMPLOYEE WHERE existsNode(RESUME, ‘//education/degree/node()’) > 1

      isFragment – returns 0 if the document is a full, well formed xml document and
      1 otherwise.
      SELECT * FROM EMPLOYEE e WHERE e.RESUME.isFragment() = 0

      getStringVal(), getNumberVal() – gets the value of the XMLType as either a
      String or a Number respectively
      SELECT * FROM EMPLOYEE WHERE extract(RESUME, ‘//education’).getStringVal()
      = ‘<school>Carleton</school><degree>BCS</degree>’
      SELECT * FROM EMPLOYEE WHERE extract(RESUME, ‘//years-experience/text
      ()’).getNumberValue() > 5

        Activity

        Hide
        marina vatkina added a comment -

        resetting the default owner

        Show
        marina vatkina added a comment - resetting the default owner
        Hide
        Sanjeeb Sahoo added a comment -

        A very good feature to have. A few comments:
        1. XMLType is supported in some other databases as well, e.g., DB2 Version 9+,
        SQLServer 2005+. So, this feature should not limit itself to Oracle database
        users only.

        2. It should allow something like this:

        @Entity class Employee

        { ... @XMLType Education education; // XMLType is a TopLink Essentials extension }

        Education.class uses JAXB for Java/XML binding.

        3. We should also allow user to specify path expressions to navigate to any
        level in the embedded object tree, and the runtime should convert it to
        appropriate XPATH.

        – Sahoo

        Show
        Sanjeeb Sahoo added a comment - A very good feature to have. A few comments: 1. XMLType is supported in some other databases as well, e.g., DB2 Version 9+, SQLServer 2005+. So, this feature should not limit itself to Oracle database users only. 2. It should allow something like this: @Entity class Employee { ... @XMLType Education education; // XMLType is a TopLink Essentials extension } Education.class uses JAXB for Java/XML binding. 3. We should also allow user to specify path expressions to navigate to any level in the embedded object tree, and the runtime should convert it to appropriate XPATH. – Sahoo
        Hide
        Tom Mueller added a comment -

        Bulk change to set fix version to "not determined" where the issue is open but the value is for a released version.

        Show
        Tom Mueller added a comment - Bulk change to set fix version to "not determined" where the issue is open but the value is for a released version.

          People

          • Assignee:
            tware
            Reporter:
            tware
          • Votes:
            8 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: