<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Is it possible to apply field order of a persistent data-class to database table?</title><link>https://answers.axonivy.com/questions/650/is-it-possible-to-apply-field-order-of-a-persistent-data-class-to-database-table</link><description>&lt;p&gt;I've noticed that if I use the persistence API to create a database table the order of the table columns is not the same as in the persistence data-class. Is it possible to keep the field order in a data-class to a database table?&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/650/is-it-possible-to-apply-field-order-of-a-persistent-data-class-to-database-table" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 06 Jun 2014 13:03:01 -0400</lastBuildDate><item><title>Comment by Nikel Weis on Nikel Weis's answer</title><link>https://answers.axonivy.com/questions/650/is-it-possible-to-apply-field-order-of-a-persistent-data-class-to-database-table#755</link><description>&lt;p&gt;I think there was a misunderstanding in my question. It is not the target to have the object in a certain order. The objective was that the columns within the database are in a certain order.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nikel Weis</dc:creator><pubDate>Fri, 06 Jun 2014 13:03:01 -0400</pubDate><guid>https://answers.axonivy.com/questions/650/is-it-possible-to-apply-field-order-of-a-persistent-data-class-to-database-table#755</guid></item><item><title>Comment by Daniel Oechslin on Nikel Weis's answer</title><link>https://answers.axonivy.com/questions/650/is-it-possible-to-apply-field-order-of-a-persistent-data-class-to-database-table#754</link><description>&lt;p&gt;You still need to use ORDER BY for certain queries because it is not guaranteed that your query result is in the very order of your database. So you need to manually ensure the order of your results, else you get a bug that is hard to pin down.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Daniel Oechslin</dc:creator><pubDate>Fri, 06 Jun 2014 09:59:19 -0400</pubDate><guid>https://answers.axonivy.com/questions/650/is-it-possible-to-apply-field-order-of-a-persistent-data-class-to-database-table#754</guid></item><item><title>Comment by Nikel Weis on Daniel Oechslin's answer</title><link>https://answers.axonivy.com/questions/650/is-it-possible-to-apply-field-order-of-a-persistent-data-class-to-database-table#753</link><description>&lt;p&gt;Thanks for your reply. That would be a possibility if the database should only be created via persistence - so +1 for that. But it is also possible to do it the other way around. :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nikel Weis</dc:creator><pubDate>Fri, 06 Jun 2014 08:49:32 -0400</pubDate><guid>https://answers.axonivy.com/questions/650/is-it-possible-to-apply-field-order-of-a-persistent-data-class-to-database-table#753</guid></item><item><title>Answer by Nikel Weis</title><link>https://answers.axonivy.com/questions/650/is-it-possible-to-apply-field-order-of-a-persistent-data-class-to-database-table/752</link><description>&lt;p&gt;Another solution is to create your database in SQL first and then create your persistence data clases accordingly to the SQL-Database. So it is possible to apply a certain order.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nikel Weis</dc:creator><pubDate>Fri, 06 Jun 2014 08:48:31 -0400</pubDate><guid>https://answers.axonivy.com/questions/650/is-it-possible-to-apply-field-order-of-a-persistent-data-class-to-database-table/752</guid></item><item><title>Answer by Daniel Oechslin</title><link>https://answers.axonivy.com/questions/650/is-it-possible-to-apply-field-order-of-a-persistent-data-class-to-database-table/731</link><description>&lt;p&gt;The only solution I can think of is if you sort your data-class alphabetically and you add the ORDER BY attribute to your database query.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Daniel Oechslin</dc:creator><pubDate>Mon, 02 Jun 2014 12:47:57 -0400</pubDate><guid>https://answers.axonivy.com/questions/650/is-it-possible-to-apply-field-order-of-a-persistent-data-class-to-database-table/731</guid></item></channel></rss>