=== modified file 'src/com/goldencode/p2j/persist/dialect/Dialect.java'
--- old/src/com/goldencode/p2j/persist/dialect/Dialect.java	2023-09-09 03:01:52 +0000
+++ new/src/com/goldencode/p2j/persist/dialect/Dialect.java	2023-11-14 12:03:51 +0000
@@ -1024,7 +1024,8 @@
       {
          P2JIndexComponent comp = comps.get(i);
          String sortCrit;
-         if (comp.isCharType()/* && comp.isIgnoreCase()*/)
+         boolean isChar = comp.isCharType();
+         if (isChar/* && comp.isIgnoreCase()*/)
          {
             sortCrit = getProcessedCharacterColumnName(comp.getColumnName(), comp.isIgnoreCase());
          }
@@ -1033,7 +1034,7 @@
             sortCrit = comp.getColumnName();
          }
          
-         orderByNulls(sb, sortCrit, null, !comp.isDescending(), false);
+         orderByNulls(sb, sortCrit, null, !comp.isDescending(), false, isChar);
          
          if (i != comps.size() - 1)
          {
@@ -1491,10 +1492,17 @@
     *          The sort direction.
     * @param   forceAsc
     *          If {@code true}, force the insertion of the default {@code asc} direction.
+    * @param   isChar
+    *          {@code true} if the field is of type character, {@code false} otherwise.
     *
     * @return  the number of expressions which were added to the string builder.
     */
-   public int orderByNulls(StringBuilder sb, String expression, String field, boolean asc, boolean forceAsc)
+   public int orderByNulls(StringBuilder sb,
+                           String expression,
+                           String field,
+                           boolean asc,
+                           boolean forceAsc,
+                           boolean isChar)
    {
       sb.append(expression);
       if (!asc)

=== modified file 'src/com/goldencode/p2j/persist/dialect/MariaDbDialect.java'
--- old/src/com/goldencode/p2j/persist/dialect/MariaDbDialect.java	2023-05-12 10:05:12 +0000
+++ new/src/com/goldencode/p2j/persist/dialect/MariaDbDialect.java	2023-11-14 12:04:22 +0000
@@ -170,24 +170,34 @@
     *          The sort direction.
     * @param   forceAsc
     *          If {@code true}, force the insertion of the default {@code asc} direction.
+    * @param   isChar
+    *          {@code true} if the field is of type character, {@code false} otherwise.
     *
     * @return  the number of expressions which were added to the string builder.
     */
    @Override
-   public int orderByNulls(StringBuilder sb, String expression, String field, boolean asc, boolean forceAsc)
+   public int orderByNulls(StringBuilder sb,
+                           String expression,
+                           String field,
+                           boolean asc,
+                           boolean forceAsc,
+                           boolean isChar)
    {
-      sb.append(field != null ? field : expression).append("__null");
-      if (!asc)
-      {
-         sb.append(" desc");
-      }
-      else if (forceAsc)
-      {
-         sb.append(" asc");
-      }
-      sb.append(",");
+      if (isChar)
+      {
+         sb.append(field != null ? field : expression).append("__null");
+         if (!asc)
+         {
+            sb.append(" desc");
+         }
+         else if (forceAsc)
+         {
+            sb.append(" asc");
+         }
+         sb.append(",");
+      }
       
-      return 1 + super.orderByNulls(sb, expression, null, asc, forceAsc);
+      return 1 + super.orderByNulls(sb, expression, null, asc, forceAsc, isChar);
    }
    
    /**

=== modified file 'src/com/goldencode/p2j/persist/dialect/P2JH2Dialect.java'
--- old/src/com/goldencode/p2j/persist/dialect/P2JH2Dialect.java	2023-10-31 12:29:01 +0000
+++ new/src/com/goldencode/p2j/persist/dialect/P2JH2Dialect.java	2023-11-14 12:04:12 +0000
@@ -1466,13 +1466,20 @@
     *          The sort direction.
     * @param   forceAsc
     *          If {@code true}, force the insertion of the default {@code asc} direction.
+    * @param   isChar
+    *          {@code true} if the field is of type character, {@code false} otherwise.
     *
     * @return  1, representing the number of expressions which were added to the string builder.
     */
    @Override
-   public int orderByNulls(StringBuilder sb, String expression, String field, boolean asc, boolean forceAsc)
+   public int orderByNulls(StringBuilder sb,
+                           String expression,
+                           String field,
+                           boolean asc,
+                           boolean forceAsc,
+                           boolean isChar)
    {
-      super.orderByNulls(sb, expression, null, asc, forceAsc);
+      super.orderByNulls(sb, expression, null, asc, forceAsc, isChar);
       sb.append(asc ? " nulls last" : " nulls first");
       return 1;
    }

