{"id":3617,"date":"2014-03-29T06:57:39","date_gmt":"2014-03-29T06:57:39","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/29\/inconsistent-dbunit-behaviour-between-platforms-with-null-dates-using-in-memory-h2-collection-of-common-programming-errors\/"},"modified":"2014-03-29T06:57:39","modified_gmt":"2014-03-29T06:57:39","slug":"inconsistent-dbunit-behaviour-between-platforms-with-null-dates-using-in-memory-h2-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/29\/inconsistent-dbunit-behaviour-between-platforms-with-null-dates-using-in-memory-h2-collection-of-common-programming-errors\/","title":{"rendered":"Inconsistent dbunit behaviour between platforms with null dates using in-memory h2-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m running into an interesting issue here with a DBUnit test.<\/p>\n<p>We have some code that we test with DBUnit tests and a xml dataset. I have inconsistent test results with exactly the same dataset and code files among platforms, so I decided to follow the trail as I will be refactoring a part of the DB Access classes.<\/p>\n<p>The issue I&#8217;m running into is the following:<\/p>\n<ol>\n<li>The Dataset has 3 records that match a certain query defined in a hbm file.<\/li>\n<li>The query does an &#8220;order by DATE_FIELD desc&#8221;, however not all the records in the dataset have this DATE_FIELD set (meaning it should be interpreted as null or the default value from the scripts, which are also identical on both platforms).<\/li>\n<\/ol>\n<p>On one platform (Linux-server) where Maven runs the tests, they are all OK, however on my PC with Windows, the records are extracted from the database (dataset) with a different order, so I get an error when the test validates the order of the records.<\/p>\n<p>So, I know that modifying the dataset will get my tests to go green on both sides, but if someone wrote this dataset without a date column in one of the records, he might have known about some business rule I&#8217;m not aware of, so I&#8217;m really not modifying the scenario as it might cause unforseen future problems.<\/p>\n<p>After searching for an answer, I&#8217;m modifying the question. The answer I&#8217;m looking for, how do I get the H2 database to be consistent with null dates on different platforms. What parameter do I have to set to get NULLS FIRST or NULLS LAST for the whole DB without touching queries?<\/p>\n<p>Thank you very much and regards.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m running into an interesting issue here with a DBUnit test. We have some code that we test with DBUnit tests and a xml dataset. I have inconsistent test results with exactly the same dataset and code files among platforms, so I decided to follow the trail as I will be refactoring a part of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3617","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3617","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3617"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3617\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}