openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hthom...@apache.org
Subject svn commit: r1636473 - in /openjpa/branches/2.2.x: ./ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/literals/
Date Mon, 03 Nov 2014 23:46:41 GMT
Author: hthomann
Date: Mon Nov  3 23:46:41 2014
New Revision: 1636473

URL: http://svn.apache.org/r1636473
Log:
OPENJPA-2534: A boolean is not converted correct when using the hint 'UseLiteralInSQL' - applied
Rick's patch to 2.2.x.

Added:
    openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/literals/
      - copied from r1636464, openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/literals/
    openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/literals/TestLiteralInSQL.java
      - copied unchanged from r1636464, openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/literals/TestLiteralInSQL.java
Modified:
    openjpa/branches/2.2.x/   (props changed)
    openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLBuffer.java

Propchange: openjpa/branches/2.2.x/
------------------------------------------------------------------------------
  Merged /openjpa/branches/2.1.x:r1636464

Modified: openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLBuffer.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLBuffer.java?rev=1636473&r1=1636472&r2=1636473&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLBuffer.java
(original)
+++ openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLBuffer.java
Mon Nov  3 23:46:41 2014
@@ -340,12 +340,17 @@ public final class SQLBuffer
             } else {
                 if (type == String.class) {
                     _sql.append("'" + o.toString().replace("'", "''") + "'");
+
                 } else if ( type == Character.class ) {
                     if (_dict.storeCharsAsNumbers) {
                         _sql.append(Integer.toString(((Character)o).charValue()));
                     } else {
                         _sql.append("'" + o.toString().replace("'", "''") + "'");
                     }
+                } else if (type == Boolean.class) {
+                    Boolean b = (Boolean) o;
+                    // We store B(b)ooleans as ints. Convert 
+                    _sql.append((b.booleanValue() ? "1" : "0"));
                 } else {
                     _sql.append(o.toString());
                 }



Mime
View raw message