You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Julian Cable (JIRA)" <ji...@apache.org> on 2011/08/18 14:31:27 UTC

[jira] [Created] (CAMEL-4350) Camel-csv with List has arbitrary column order

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

                 Key: CAMEL-4350
                 URL: https://issues.apache.org/jira/browse/CAMEL-4350
             Project: Camel
          Issue Type: Improvement
    Affects Versions: 2.7.1
         Environment: java 1.6
            Reporter: Julian Cable


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>


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4350) Camel-jdbc with List has arbitrary column order

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13094331#comment-13094331 ] 

Claus Ibsen commented on CAMEL-4350:
------------------------------------

Yeah fell free to provide a unit test for camel-sql as well.

> Camel-jdbc with List<Map> has arbitrary column order
> ----------------------------------------------------
>
>                 Key: CAMEL-4350
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4350
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jdbc, camel-sql
>    Affects Versions: 2.7.1
>         Environment: java 1.6
>            Reporter: Julian Cable
>            Assignee: Mathieu Lalonde
>            Priority: Minor
>             Fix For: 2.9.0
>
>         Attachments: camel-jdbc_keyOrdering.tar
>
>
> 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>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4350) Camel-csv with List has arbitrary column order

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13086996#comment-13086996 ] 

Claus Ibsen commented on CAMEL-4350:
------------------------------------

Good catch. Do you want to help with providing a patch? It seems like the fix would be a fairly simple change to use a LinkedHashMap to ensure the ordering.

You can read about contributing here
http://camel.apache.org/contributing.html

> Camel-csv with List<Map> has arbitrary column order
> ---------------------------------------------------
>
>                 Key: CAMEL-4350
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4350
>             Project: Camel
>          Issue Type: Improvement
>    Affects Versions: 2.7.1
>         Environment: java 1.6
>            Reporter: Julian Cable
>             Fix For: 2.9.0
>
>
> 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>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4350) Camel-jdbc with List has arbitrary column order

Posted by "Mathieu Lalonde (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13092412#comment-13092412 ] 

Mathieu Lalonde commented on CAMEL-4350:
----------------------------------------

I'd like to try writing the patch & unit tests.

> Camel-jdbc with List<Map> has arbitrary column order
> ----------------------------------------------------
>
>                 Key: CAMEL-4350
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4350
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jdbc, camel-sql
>    Affects Versions: 2.7.1
>         Environment: java 1.6
>            Reporter: Julian Cable
>            Priority: Minor
>             Fix For: 2.9.0
>
>
> 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>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4350) Camel-jdbc with List has arbitrary column order

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13087615#comment-13087615 ] 

Claus Ibsen commented on CAMEL-4350:
------------------------------------

By fixing it in camel-jdbc and camel-sql the order of the List<Map> is as the ResultSet have returned. And thus marshalling to csv will be in the same order as well.

> Camel-jdbc with List<Map> has arbitrary column order
> ----------------------------------------------------
>
>                 Key: CAMEL-4350
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4350
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jdbc, camel-sql
>    Affects Versions: 2.7.1
>         Environment: java 1.6
>            Reporter: Julian Cable
>            Priority: Minor
>             Fix For: 2.9.0
>
>
> 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>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CAMEL-4350) Camel-jdbc with List has arbitrary column order

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-4350:
-------------------------------

    Component/s: camel-sql
                 camel-jdbc
        Summary: Camel-jdbc with List<Map> has arbitrary column order  (was: Camel-csv with List<Map> has arbitrary column order)

Assuming its the camel-jdbc component, which is shown above.
The same issue could apply for camel-sql

> Camel-jdbc with List<Map> has arbitrary column order
> ----------------------------------------------------
>
>                 Key: CAMEL-4350
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4350
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jdbc, camel-sql
>    Affects Versions: 2.7.1
>         Environment: java 1.6
>            Reporter: Julian Cable
>            Priority: Minor
>             Fix For: 2.9.0
>
>
> 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>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CAMEL-4350) Camel-jdbc with List has arbitrary column order

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-4350.
--------------------------------

    Resolution: Fixed

Mathieu, please create a new ticket. As this ticket is titled about the camel-jdbc which has been fixed.

> Camel-jdbc with List<Map> has arbitrary column order
> ----------------------------------------------------
>
>                 Key: CAMEL-4350
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4350
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jdbc, camel-sql
>    Affects Versions: 2.7.1
>         Environment: java 1.6
>            Reporter: Julian Cable
>            Assignee: Mathieu Lalonde
>            Priority: Minor
>             Fix For: 2.9.0
>
>         Attachments: camel-jdbc_keyOrdering.tar
>
>
> 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>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4350) Camel-jdbc with List has arbitrary column order

Posted by "Mathieu Lalonde (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13094175#comment-13094175 ] 

Mathieu Lalonde commented on CAMEL-4350:
----------------------------------------

Based on the SqlProducer code & the javadoc for Spring's ColumnMapRowMapper, the keys should already be in a deterministic order.  I can add a unit test in case we change the implementation down the road.

> Camel-jdbc with List<Map> has arbitrary column order
> ----------------------------------------------------
>
>                 Key: CAMEL-4350
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4350
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jdbc, camel-sql
>    Affects Versions: 2.7.1
>         Environment: java 1.6
>            Reporter: Julian Cable
>            Assignee: Mathieu Lalonde
>            Priority: Minor
>             Fix For: 2.9.0
>
>         Attachments: camel-jdbc_keyOrdering.tar
>
>
> 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>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4350) Camel-csv with List has arbitrary column order

Posted by "Julian Cable (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13087195#comment-13087195 ] 

Julian Cable commented on CAMEL-4350:
-------------------------------------

Hi Claus,

  happy to, but it will have to wait a couple of weeks. I'm on leave from tomorrow and maxed out the following week.

Julian

> Camel-csv with List<Map> has arbitrary column order
> ---------------------------------------------------
>
>                 Key: CAMEL-4350
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4350
>             Project: Camel
>          Issue Type: Improvement
>    Affects Versions: 2.7.1
>         Environment: java 1.6
>            Reporter: Julian Cable
>            Priority: Minor
>             Fix For: 2.9.0
>
>
> 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>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CAMEL-4350) Camel-csv with List has arbitrary column order

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-4350:
-------------------------------

         Priority: Minor  (was: Major)
    Fix Version/s: 2.9.0

> Camel-csv with List<Map> has arbitrary column order
> ---------------------------------------------------
>
>                 Key: CAMEL-4350
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4350
>             Project: Camel
>          Issue Type: Improvement
>    Affects Versions: 2.7.1
>         Environment: java 1.6
>            Reporter: Julian Cable
>            Priority: Minor
>             Fix For: 2.9.0
>
>
> 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>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CAMEL-4350) Camel-jdbc with List has arbitrary column order

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-4350.
--------------------------------

    Resolution: Fixed

Thanks for the patch.

> Camel-jdbc with List<Map> has arbitrary column order
> ----------------------------------------------------
>
>                 Key: CAMEL-4350
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4350
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jdbc, camel-sql
>    Affects Versions: 2.7.1
>         Environment: java 1.6
>            Reporter: Julian Cable
>            Assignee: Mathieu Lalonde
>            Priority: Minor
>             Fix For: 2.9.0
>
>         Attachments: camel-jdbc_keyOrdering.tar
>
>
> 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>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CAMEL-4350) Camel-jdbc with List has arbitrary column order

Posted by "Mathieu Lalonde (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mathieu Lalonde updated CAMEL-4350:
-----------------------------------

    Attachment: camel-jdbc_keyOrdering.tar

Thanks for the encouragement Claus! :)

The attached patch has a trivial code change (use LinkedHashMap) and adds a Test class (JdbcRouteKeyOrderingTest).

Also added cautionary comments to JdbcRouteTest.

> Camel-jdbc with List<Map> has arbitrary column order
> ----------------------------------------------------
>
>                 Key: CAMEL-4350
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4350
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jdbc, camel-sql
>    Affects Versions: 2.7.1
>         Environment: java 1.6
>            Reporter: Julian Cable
>            Assignee: Mathieu Lalonde
>            Priority: Minor
>             Fix For: 2.9.0
>
>         Attachments: camel-jdbc_keyOrdering.tar
>
>
> 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>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Work started] (CAMEL-4350) Camel-jdbc with List has arbitrary column order

Posted by "Mathieu Lalonde (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on CAMEL-4350 started by Mathieu Lalonde.

> Camel-jdbc with List<Map> has arbitrary column order
> ----------------------------------------------------
>
>                 Key: CAMEL-4350
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4350
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jdbc, camel-sql
>    Affects Versions: 2.7.1
>         Environment: java 1.6
>            Reporter: Julian Cable
>            Assignee: Mathieu Lalonde
>            Priority: Minor
>             Fix For: 2.9.0
>
>
> 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>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (CAMEL-4350) Camel-jdbc with List has arbitrary column order

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-4350:
----------------------------------

    Assignee: Mathieu Lalonde

Mathieu I have put your into the contributor group so you can assign JIRA tickets that you work on. Looking forward for the patch :)

> Camel-jdbc with List<Map> has arbitrary column order
> ----------------------------------------------------
>
>                 Key: CAMEL-4350
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4350
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jdbc, camel-sql
>    Affects Versions: 2.7.1
>         Environment: java 1.6
>            Reporter: Julian Cable
>            Assignee: Mathieu Lalonde
>            Priority: Minor
>             Fix For: 2.9.0
>
>
> 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>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4350) Camel-csv with List has arbitrary column order

Posted by "Julian Cable (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13087203#comment-13087203 ] 

Julian Cable commented on CAMEL-4350:
-------------------------------------

I don't have time to try it, but it looks like changing HashMap to LinkedHashMap on lines 25 and 197 of 

/camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java

would do the trick.

Julian

> Camel-csv with List<Map> has arbitrary column order
> ---------------------------------------------------
>
>                 Key: CAMEL-4350
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4350
>             Project: Camel
>          Issue Type: Improvement
>    Affects Versions: 2.7.1
>         Environment: java 1.6
>            Reporter: Julian Cable
>            Priority: Minor
>             Fix For: 2.9.0
>
>
> 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>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CAMEL-4350) Camel-jdbc with List has arbitrary column order

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp updated CAMEL-4350:
-------------------------------

    Fix Version/s: 2.8.2

> Camel-jdbc with List<Map> has arbitrary column order
> ----------------------------------------------------
>
>                 Key: CAMEL-4350
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4350
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jdbc, camel-sql
>    Affects Versions: 2.7.1
>         Environment: java 1.6
>            Reporter: Julian Cable
>            Assignee: Mathieu Lalonde
>            Priority: Minor
>             Fix For: 2.8.2, 2.9.0
>
>         Attachments: camel-jdbc_keyOrdering.tar
>
>
> 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>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Reopened] (CAMEL-4350) Camel-jdbc with List has arbitrary column order

Posted by "Mathieu Lalonde (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mathieu Lalonde reopened CAMEL-4350:
------------------------------------


I was going to submit a patch for the camel-sql component as well.  I should have it done in the next few days.

> Camel-jdbc with List<Map> has arbitrary column order
> ----------------------------------------------------
>
>                 Key: CAMEL-4350
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4350
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jdbc, camel-sql
>    Affects Versions: 2.7.1
>         Environment: java 1.6
>            Reporter: Julian Cable
>            Assignee: Mathieu Lalonde
>            Priority: Minor
>             Fix For: 2.9.0
>
>         Attachments: camel-jdbc_keyOrdering.tar
>
>
> 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>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira