Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-4350

Camel-jdbc with List<Map> has arbitrary column order

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.7.1
    • 2.8.2, 2.9.0
    • camel-jdbc, camel-sql
    • None
    • java 1.6

    • Novice

    Description

      The following route works but the order of the columns is dependent on the natural ordering of the hashmap. Target systems will have an expectation of the order of the data.

      <route>
      <from uri="jetty:http://0.0.0.0:16081/css/mes"/>
      <setBody>
      <constant>SELECT id, value1, value2 FROM mytable</constant>
      </setBody>
      <to uri="jdbc:mydb"/>
      <marshal>
      <csv/>
      </marshal>
      </route>

      Either there needs to be a property for csv that allows hash key ordering to be specified, or an option to sort the keys, e.g.

      <route>
      <from uri="jetty:http://0.0.0.0:16081/css/mes"/>
      <setBody>
      <constant>SELECT id as col1, value1 as col2, value2 as col3 FROM mytable</constant>
      </setBody>
      <to uri="jdbc:mydb"/>
      <marshal>
      <csv sortFields="true" />
      </marshal>
      </route>

      Attachments

        1. camel-jdbc_keyOrdering.tar
          10 kB
          Mathieu Lalonde

        Activity

          People

            mrlalonde Mathieu Lalonde
            julian.cable Julian Cable
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: