IDEMPIERE-6149 Model[Class|Interface]Generator must have a predictable order independent of the developer language (collation) (#2368)

This commit is contained in:
Carlos Ruiz 2024-05-18 04:14:09 +02:00
parent ecfb71bd7d
commit a3fb6f5b9c
2 changed files with 12 additions and 0 deletions

View File

@ -318,6 +318,10 @@ public class ModelClassGenerator
+ " AND c.IsActive='Y' AND (c.ColumnSQL IS NULL OR c.ColumnSQL NOT LIKE '@SQL%') " + " AND c.IsActive='Y' AND (c.ColumnSQL IS NULL OR c.ColumnSQL NOT LIKE '@SQL%') "
+ (!Util.isEmpty(entityTypeFilter) ? " AND c." + entityTypeFilter : "") + (!Util.isEmpty(entityTypeFilter) ? " AND c." + entityTypeFilter : "")
+ " ORDER BY c.ColumnName"; + " ORDER BY c.ColumnName";
if (DB.isOracle())
sql += " COLLATE \"BINARY\"";
else if (DB.isPostgreSQL())
sql += " COLLATE \"C\"";
boolean isKeyNamePairCreated = false; // true if the method "getKeyNamePair" is already generated boolean isKeyNamePairCreated = false; // true if the method "getKeyNamePair" is already generated
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
@ -669,6 +673,10 @@ public class ModelClassGenerator
StringBuilder statement = new StringBuilder(); StringBuilder statement = new StringBuilder();
// //
String sql = "SELECT Value, Name FROM AD_Ref_List WHERE AD_Reference_ID=? ORDER BY Value"; // even inactive, see IDEMPIERE-4979 String sql = "SELECT Value, Name FROM AD_Ref_List WHERE AD_Reference_ID=? ORDER BY Value"; // even inactive, see IDEMPIERE-4979
if (DB.isOracle())
sql += " COLLATE \"BINARY\"";
else if (DB.isPostgreSQL())
sql += " COLLATE \"C\"";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try

View File

@ -252,6 +252,10 @@ public class ModelInterfaceGenerator
+ " AND c.IsActive='Y' AND (c.ColumnSQL IS NULL OR c.ColumnSQL NOT LIKE '@SQL%') " + " AND c.IsActive='Y' AND (c.ColumnSQL IS NULL OR c.ColumnSQL NOT LIKE '@SQL%') "
+ (!Util.isEmpty(entityTypeFilter) ? " AND c." + entityTypeFilter : "") + (!Util.isEmpty(entityTypeFilter) ? " AND c." + entityTypeFilter : "")
+ " ORDER BY c.ColumnName"; + " ORDER BY c.ColumnName";
if (DB.isOracle())
sql += " COLLATE \"BINARY\"";
else if (DB.isPostgreSQL())
sql += " COLLATE \"C\"";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try { try {