cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skolbac...@apache.org
Subject [1/2] cayenne git commit: CAY-2139 Upgrade HSQLDB dependency to the most recent version (2.3.4)
Date Wed, 21 Dec 2016 11:55:53 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 3ad0f4a22 -> 48d9d7bfc


CAY-2139
Upgrade HSQLDB dependency to the most recent version (2.3.4)


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/fdf3a89b
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/fdf3a89b
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/fdf3a89b

Branch: refs/heads/master
Commit: fdf3a89bf5ea05aa51a53688b9aae4c83ed1fcd8
Parents: 3ad0f4a
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Tue Dec 20 18:12:52 2016 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Tue Dec 20 18:12:52 2016 +0300

----------------------------------------------------------------------
 cayenne-crypto/pom.xml                          |  2 +-
 .../apache/cayenne/crypto/db/auto/_Table1.java  |  8 +--
 .../apache/cayenne/crypto/db/auto/_Table2.java  |  4 +-
 .../apache/cayenne/crypto/db/auto/_Table3.java  |  2 +-
 .../apache/cayenne/crypto/db/auto/_Table4.java  |  4 +-
 .../src/test/resources/datamap.map.xml          |  4 +-
 .../reverse/dbload/AttributeLoaderIT.java       | 12 ++--
 cayenne-java8/pom.xml                           |  2 +-
 cayenne-joda/pom.xml                            |  2 +-
 cayenne-lifecycle/pom.xml                       |  2 +-
 cayenne-protostuff/pom.xml                      |  2 +-
 .../cayenne/dba/hsqldb/HSQLDBAdapter.java       | 43 +++++++++++++
 .../hsqldb/HSQLEJBQLConditionTranslator.java    | 65 ++++++++++++++++++++
 .../dba/hsqldb/HSQLEJBQLTranslatorFactory.java  | 35 +++++++++++
 .../dba/hsqldb/HSQLQualifierTranslator.java     | 57 +++++++++++++++++
 .../cayenne/access/DataContextCrossDBIT.java    |  7 +++
 .../DataContextEJBQLNumericalFunctionalIT.java  |  7 ++-
 .../cayenne/unit/HSQLDBUnitDbAdapter.java       |  9 +++
 .../resources/ddl/hsqldb/create-sp-aliases.sql  |  6 +-
 docs/doc/src/main/resources/RELEASE-NOTES.txt   |  1 +
 pom.xml                                         | 12 ++--
 21 files changed, 256 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-crypto/pom.xml
----------------------------------------------------------------------
diff --git a/cayenne-crypto/pom.xml b/cayenne-crypto/pom.xml
index 0d7d1fb..74b60b9 100644
--- a/cayenne-crypto/pom.xml
+++ b/cayenne-crypto/pom.xml
@@ -53,7 +53,7 @@
 			<scope>test</scope>
 		</dependency>
 		<dependency>
-			<groupId>hsqldb</groupId>
+			<groupId>org.hsqldb</groupId>
 			<artifactId>hsqldb</artifactId>
 			<scope>test</scope>
 		</dependency>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table1.java
----------------------------------------------------------------------
diff --git a/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table1.java b/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table1.java
index 97116c4..1a22f44 100644
--- a/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table1.java
+++ b/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table1.java
@@ -15,10 +15,10 @@ public abstract class _Table1 extends CayenneDataObject {
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<Integer> CRYPTO_INT = new Property<Integer>("cryptoInt");
-    public static final Property<String> CRYPTO_STRING = new Property<String>("cryptoString");
-    public static final Property<Integer> PLAIN_INT = new Property<Integer>("plainInt");
-    public static final Property<String> PLAIN_STRING = new Property<String>("plainString");
+    public static final Property<Integer> CRYPTO_INT = new Property<>("cryptoInt");
+    public static final Property<String> CRYPTO_STRING = new Property<>("cryptoString");
+    public static final Property<Integer> PLAIN_INT = new Property<>("plainInt");
+    public static final Property<String> PLAIN_STRING = new Property<>("plainString");
 
     public void setCryptoInt(int cryptoInt) {
         writeProperty("cryptoInt", cryptoInt);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table2.java
----------------------------------------------------------------------
diff --git a/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table2.java b/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table2.java
index 2a914d4..5cc9133 100644
--- a/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table2.java
+++ b/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table2.java
@@ -15,8 +15,8 @@ public abstract class _Table2 extends CayenneDataObject {
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<byte[]> CRYPTO_BYTES = new Property<byte[]>("cryptoBytes");
-    public static final Property<byte[]> PLAIN_BYTES = new Property<byte[]>("plainBytes");
+    public static final Property<byte[]> CRYPTO_BYTES = new Property<>("cryptoBytes");
+    public static final Property<byte[]> PLAIN_BYTES = new Property<>("plainBytes");
 
     public void setCryptoBytes(byte[] cryptoBytes) {
         writeProperty("cryptoBytes", cryptoBytes);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table3.java
----------------------------------------------------------------------
diff --git a/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table3.java b/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table3.java
index 937b1e6..f21a3fa 100644
--- a/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table3.java
+++ b/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table3.java
@@ -15,7 +15,7 @@ public abstract class _Table3 extends CayenneDataObject {
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<String> CRYPTO_STRING = new Property<String>("cryptoString");
+    public static final Property<String> CRYPTO_STRING = new Property<>("cryptoString");
 
     public void setCryptoString(String cryptoString) {
         writeProperty("cryptoString", cryptoString);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table4.java
----------------------------------------------------------------------
diff --git a/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table4.java b/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table4.java
index 3f825bc..6349072 100644
--- a/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table4.java
+++ b/cayenne-crypto/src/test/java/org/apache/cayenne/crypto/db/auto/_Table4.java
@@ -15,8 +15,8 @@ public abstract class _Table4 extends CayenneDataObject {
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<Integer> PLAIN_INT = new Property<Integer>("plainInt");
-    public static final Property<String> PLAIN_STRING = new Property<String>("plainString");
+    public static final Property<Integer> PLAIN_INT = new Property<>("plainInt");
+    public static final Property<String> PLAIN_STRING = new Property<>("plainString");
 
     public void setPlainInt(int plainInt) {
         writeProperty("plainInt", plainInt);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-crypto/src/test/resources/datamap.map.xml
----------------------------------------------------------------------
diff --git a/cayenne-crypto/src/test/resources/datamap.map.xml b/cayenne-crypto/src/test/resources/datamap.map.xml
index 4182205..51c0840 100644
--- a/cayenne-crypto/src/test/resources/datamap.map.xml
+++ b/cayenne-crypto/src/test/resources/datamap.map.xml
@@ -14,10 +14,10 @@
 	<db-entity name="TABLE2">
 		<db-attribute name="CRYPTO_BYTES" type="BLOB"/>
 		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
-		<db-attribute name="PLAIN_BYTES" type="VARBINARY"/>
+		<db-attribute name="PLAIN_BYTES" type="LONGVARBINARY"/>
 	</db-entity>
 	<db-entity name="TABLE3">
-		<db-attribute name="CRYPTO_BYTES" type="VARBINARY"/>
+		<db-attribute name="CRYPTO_BYTES" type="LONGVARBINARY"/>
 		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
 	</db-entity>
 	<db-entity name="TABLE4">

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/reverse/dbload/AttributeLoaderIT.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/reverse/dbload/AttributeLoaderIT.java
b/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/reverse/dbload/AttributeLoaderIT.java
index d1abac5..f0207bb 100644
--- a/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/reverse/dbload/AttributeLoaderIT.java
+++ b/cayenne-dbsync/src/test/java/org/apache/cayenne/dbsync/reverse/dbload/AttributeLoaderIT.java
@@ -119,15 +119,19 @@ public class AttributeLoaderIT extends BaseLoaderIT {
         assertNotNull(blobEnt);
         DbAttribute blobAttr = getDbAttribute(blobEnt, "BLOB_COL");
         assertNotNull(blobAttr);
-        assertTrue(msgForTypeMismatch(Types.BLOB, blobAttr), Types.BLOB == blobAttr.getType()
-                || Types.LONGVARBINARY == blobAttr.getType());
+        assertTrue(msgForTypeMismatch(Types.BLOB, blobAttr),
+                Types.BLOB == blobAttr.getType()
+                        || Types.VARBINARY == blobAttr.getType()
+                        || Types.LONGVARBINARY == blobAttr.getType());
 
         DbEntity clobEnt = getDbEntity("CLOB_TEST");
         assertNotNull(clobEnt);
         DbAttribute clobAttr = getDbAttribute(clobEnt, "CLOB_COL");
         assertNotNull(clobAttr);
-        assertTrue(msgForTypeMismatch(Types.CLOB, clobAttr), Types.CLOB == clobAttr.getType()
-                || Types.LONGVARCHAR == clobAttr.getType());
+        assertTrue(msgForTypeMismatch(Types.CLOB, clobAttr),
+                Types.CLOB == clobAttr.getType()
+                        || Types.VARCHAR == clobAttr.getType()
+                        || Types.LONGVARCHAR == clobAttr.getType());
     }
 
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-java8/pom.xml
----------------------------------------------------------------------
diff --git a/cayenne-java8/pom.xml b/cayenne-java8/pom.xml
index 525f1b3..54096c2 100644
--- a/cayenne-java8/pom.xml
+++ b/cayenne-java8/pom.xml
@@ -42,7 +42,7 @@
 			<scope>test</scope>
 		</dependency>
 		<dependency>
-			<groupId>hsqldb</groupId>
+			<groupId>org.hsqldb</groupId>
 			<artifactId>hsqldb</artifactId>
 			<scope>test</scope>
 		</dependency>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-joda/pom.xml
----------------------------------------------------------------------
diff --git a/cayenne-joda/pom.xml b/cayenne-joda/pom.xml
index b03b5e5..7e969cf 100644
--- a/cayenne-joda/pom.xml
+++ b/cayenne-joda/pom.xml
@@ -78,7 +78,7 @@
 			<scope>test</scope>
 		</dependency>
 		<dependency>
-			<groupId>hsqldb</groupId>
+			<groupId>org.hsqldb</groupId>
 			<artifactId>hsqldb</artifactId>
 			<scope>test</scope>
 		</dependency>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-lifecycle/pom.xml
----------------------------------------------------------------------
diff --git a/cayenne-lifecycle/pom.xml b/cayenne-lifecycle/pom.xml
index 106cfd4..04d62a1 100644
--- a/cayenne-lifecycle/pom.xml
+++ b/cayenne-lifecycle/pom.xml
@@ -46,7 +46,7 @@
 			<scope>test</scope>
 		</dependency>
 		<dependency>
-			<groupId>hsqldb</groupId>
+			<groupId>org.hsqldb</groupId>
 			<artifactId>hsqldb</artifactId>
 			<scope>test</scope>
 		</dependency>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-protostuff/pom.xml
----------------------------------------------------------------------
diff --git a/cayenne-protostuff/pom.xml b/cayenne-protostuff/pom.xml
index 969e9d0..0328db7 100644
--- a/cayenne-protostuff/pom.xml
+++ b/cayenne-protostuff/pom.xml
@@ -82,7 +82,7 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>hsqldb</groupId>
+            <groupId>org.hsqldb</groupId>
             <artifactId>hsqldb</artifactId>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-server/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBAdapter.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBAdapter.java
b/cayenne-server/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBAdapter.java
index 96c5c0b..d38a56a 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBAdapter.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBAdapter.java
@@ -21,9 +21,16 @@ package org.apache.cayenne.dba.hsqldb;
 
 import org.apache.cayenne.CayenneRuntimeException;
 import org.apache.cayenne.access.DataNode;
+import org.apache.cayenne.access.translator.ParameterBinding;
+import org.apache.cayenne.access.translator.ejbql.EJBQLTranslatorFactory;
+import org.apache.cayenne.access.translator.ejbql.JdbcEJBQLTranslatorFactory;
+import org.apache.cayenne.access.translator.select.QualifierTranslator;
+import org.apache.cayenne.access.translator.select.QueryAssembler;
 import org.apache.cayenne.access.translator.select.SelectTranslator;
+import org.apache.cayenne.access.types.CharType;
 import org.apache.cayenne.access.types.ExtendedType;
 import org.apache.cayenne.access.types.ExtendedTypeFactory;
+import org.apache.cayenne.access.types.ExtendedTypeMap;
 import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.configuration.RuntimeProperties;
 import org.apache.cayenne.dba.JdbcAdapter;
@@ -38,6 +45,8 @@ import org.apache.cayenne.query.SQLAction;
 import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.resource.ResourceLocator;
 
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
 import java.sql.Types;
 import java.util.Collection;
 import java.util.Iterator;
@@ -57,6 +66,8 @@ import java.util.List;
  */
 public class HSQLDBAdapter extends JdbcAdapter {
 
+	public static final String TRIM_FUNCTION = "RTRIM";
+
 	public HSQLDBAdapter(@Inject RuntimeProperties runtimeProperties,
 			@Inject(Constants.SERVER_DEFAULT_TYPES_LIST) List<ExtendedType> defaultExtendedTypes,
 			@Inject(Constants.SERVER_USER_TYPES_LIST) List<ExtendedType> userExtendedTypes,
@@ -69,11 +80,43 @@ public class HSQLDBAdapter extends JdbcAdapter {
 	 * @since 4.0
 	 */
 	@Override
+	protected void configureExtendedTypes(ExtendedTypeMap map) {
+		super.configureExtendedTypes(map);
+
+		// create specially configured CharType handler
+		map.registerType(new CharType(true, true));
+	}
+
+	/**
+	 * @since 4.0
+	 */
+	@Override
 	public SelectTranslator getSelectTranslator(SelectQuery<?> query, EntityResolver entityResolver)
{
 		return new HSQLSelectTranslator(query, this, entityResolver);
 	}
 
 	/**
+	 * Returns a trimming translator.
+	 * @since 4.0
+	 */
+	@Override
+	public QualifierTranslator getQualifierTranslator(QueryAssembler queryAssembler) {
+		QualifierTranslator translator = new HSQLQualifierTranslator(queryAssembler);
+		translator.setCaseInsensitive(caseInsensitiveCollations);
+		return translator;
+	}
+
+	/**
+	 * @since 4.0
+	 */
+	@Override
+	protected EJBQLTranslatorFactory createEJBQLTranslatorFactory() {
+		JdbcEJBQLTranslatorFactory translatorFactory = new HSQLEJBQLTranslatorFactory();
+		translatorFactory.setCaseInsensitive(caseInsensitiveCollations);
+		return translatorFactory;
+	}
+
+	/**
 	 * Generate fully-qualified name for 1.8 and on. Subclass generates
 	 * unqualified name.
 	 * 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-server/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLEJBQLConditionTranslator.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLEJBQLConditionTranslator.java
b/cayenne-server/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLEJBQLConditionTranslator.java
new file mode 100644
index 0000000..7a1c12c
--- /dev/null
+++ b/cayenne-server/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLEJBQLConditionTranslator.java
@@ -0,0 +1,65 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.dba.hsqldb;
+
+import java.sql.Types;
+
+import org.apache.cayenne.access.translator.ejbql.EJBQLConditionTranslator;
+import org.apache.cayenne.access.translator.ejbql.EJBQLMultiColumnOperand;
+import org.apache.cayenne.access.translator.ejbql.EJBQLPathTranslator;
+import org.apache.cayenne.access.translator.ejbql.EJBQLTranslationContext;
+import org.apache.cayenne.ejbql.EJBQLExpression;
+import org.apache.cayenne.map.ObjAttribute;
+
+/**
+ * @since 4.0
+ */
+public class HSQLEJBQLConditionTranslator extends EJBQLConditionTranslator {
+
+    HSQLEJBQLConditionTranslator(EJBQLTranslationContext context) {
+        super(context);
+    }
+
+    @Override
+    public boolean visitPath(EJBQLExpression expression, int finishedChildIndex) {
+
+        expression.visit(new EJBQLPathTranslator(context) {
+
+            @Override
+            protected void appendMultiColumnPath(EJBQLMultiColumnOperand operand) {
+                HSQLEJBQLConditionTranslator.this.addMultiColumnOperand(operand);
+            }
+
+            @Override
+            protected void processTerminatingAttribute(ObjAttribute attribute) {
+                if (attribute.getDbAttribute().getType() == Types.CHAR) {
+                    context.append(' ').append(HSQLDBAdapter.TRIM_FUNCTION).append("(");
+                    super.processTerminatingAttribute(attribute);
+                    context.append(')');
+                }
+                else {
+                    super.processTerminatingAttribute(attribute);
+                }
+            }
+        });
+
+        return false;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-server/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLEJBQLTranslatorFactory.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLEJBQLTranslatorFactory.java
b/cayenne-server/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLEJBQLTranslatorFactory.java
new file mode 100644
index 0000000..63d3b11
--- /dev/null
+++ b/cayenne-server/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLEJBQLTranslatorFactory.java
@@ -0,0 +1,35 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.dba.hsqldb;
+
+import org.apache.cayenne.access.translator.ejbql.EJBQLTranslationContext;
+import org.apache.cayenne.access.translator.ejbql.JdbcEJBQLTranslatorFactory;
+import org.apache.cayenne.ejbql.EJBQLExpressionVisitor;
+
+/**
+ * @since 4.0
+ */
+public class HSQLEJBQLTranslatorFactory extends JdbcEJBQLTranslatorFactory {
+
+    @Override
+    public EJBQLExpressionVisitor getConditionTranslator(EJBQLTranslationContext context)
{
+        return new HSQLEJBQLConditionTranslator(context);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-server/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLQualifierTranslator.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLQualifierTranslator.java
b/cayenne-server/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLQualifierTranslator.java
new file mode 100644
index 0000000..ec3fa50
--- /dev/null
+++ b/cayenne-server/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLQualifierTranslator.java
@@ -0,0 +1,57 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.dba.hsqldb;
+
+import java.io.IOException;
+
+import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.access.translator.select.QueryAssembler;
+import org.apache.cayenne.access.translator.select.TrimmingQualifierTranslator;
+import org.apache.cayenne.exp.parser.PatternMatchNode;
+
+/**
+ * @since 4.0
+ */
+public class HSQLQualifierTranslator extends TrimmingQualifierTranslator {
+
+    public HSQLQualifierTranslator(QueryAssembler queryAssembler) {
+        super(queryAssembler, HSQLDBAdapter.TRIM_FUNCTION);
+    }
+
+    @Override
+    protected void appendLikeEscapeCharacter(PatternMatchNode patternMatchNode)
+            throws IOException {
+
+        char escapeChar = patternMatchNode.getEscapeChar();
+
+        if ('?' == escapeChar) {
+            throw new CayenneRuntimeException(
+                    "the escape character of '?' is illegal for LIKE clauses.");
+        }
+
+        if (0 != escapeChar) {
+            // this is a difference with super implementation - HSQL driver seems does not
+            // support JDBC escape syntax, so creating an explicit SQL escape:
+            out.append(" ESCAPE '");
+            out.append(escapeChar);
+            out.append("'");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextCrossDBIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextCrossDBIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextCrossDBIT.java
index 8ac4620..3881244 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextCrossDBIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextCrossDBIT.java
@@ -23,6 +23,7 @@ import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.testdo.db1.CrossdbM1E1;
 import org.apache.cayenne.testdo.db2.CrossdbM2E1;
 import org.apache.cayenne.testdo.db2.CrossdbM2E2;
+import org.apache.cayenne.unit.UnitDbAdapter;
 import org.apache.cayenne.unit.di.server.CayenneProjects;
 import org.apache.cayenne.unit.di.server.ServerCase;
 import org.apache.cayenne.unit.di.server.UseServerRuntime;
@@ -34,9 +35,15 @@ public class DataContextCrossDBIT extends ServerCase {
     @Inject
     private DataContext context;
 
+    @Inject
+    private UnitDbAdapter dbAdapter;
+
     @Test
     public void testMultiDBUpdate() {
 
+        if(!dbAdapter.supportsPKGeneratorConcurrency()) {
+            return;
+        }
         // for now testing that no exceptions are thrown... wouldn't hurt to check the
         // data as well???
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextEJBQLNumericalFunctionalIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextEJBQLNumericalFunctionalIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextEJBQLNumericalFunctionalIT.java
index bc7de1b..b1ea0e2 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextEJBQLNumericalFunctionalIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextEJBQLNumericalFunctionalIT.java
@@ -24,6 +24,9 @@ import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.QueryResponse;
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.query.EJBQLQuery;
+import org.apache.cayenne.query.SQLSelect;
+import org.apache.cayenne.query.Select;
+import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.test.jdbc.DBHelper;
 import org.apache.cayenne.test.jdbc.TableHelper;
 import org.apache.cayenne.testdo.numeric_types.BigDecimalEntity;
@@ -72,10 +75,10 @@ public class DataContextEJBQLNumericalFunctionalIT extends ServerCase
{
         context.commitChanges();
 
         EJBQLQuery query = new EJBQLQuery(
-                "SELECT d FROM BigDecimalEntity d WHERE ABS(d.bigDecimalField) > 4.5");
+                "SELECT d FROM BigDecimalEntity d WHERE ABS(d.bigDecimalField) < 5.0");
         List<?> objects = context.performQuery(query);
         assertEquals(1, objects.size());
-        assertTrue(objects.contains(o2));
+        assertTrue(objects.contains(o1));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-server/src/test/java/org/apache/cayenne/unit/HSQLDBUnitDbAdapter.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/unit/HSQLDBUnitDbAdapter.java
b/cayenne-server/src/test/java/org/apache/cayenne/unit/HSQLDBUnitDbAdapter.java
index 4fb5e94..29b99fe 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/unit/HSQLDBUnitDbAdapter.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/unit/HSQLDBUnitDbAdapter.java
@@ -57,6 +57,15 @@ public class HSQLDBUnitDbAdapter extends UnitDbAdapter {
         }
     }
 
+    /**
+     * In HyperSQL, REAL, FLOAT, DOUBLE are equivalent and all mapped to double in Java
+     * @see <a href="http://hsqldb.org/doc/guide/sqlgeneral-chapt.html#sgc_numeric_types">HSQLDB
data types documentation</a>
+     */
+    @Override
+    public boolean realAsDouble() {
+        return true;
+    }
+
     @Override
     public boolean supportsPKGeneratorConcurrency() {
         // HSQL is not locking AUTO_PK_TABLE, so running PkGenerator in parallel may result
in conflicting ranges

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/cayenne-server/src/test/resources/ddl/hsqldb/create-sp-aliases.sql
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/resources/ddl/hsqldb/create-sp-aliases.sql b/cayenne-server/src/test/resources/ddl/hsqldb/create-sp-aliases.sql
index aee8f7e..969ed2b 100644
--- a/cayenne-server/src/test/resources/ddl/hsqldb/create-sp-aliases.sql
+++ b/cayenne-server/src/test/resources/ddl/hsqldb/create-sp-aliases.sql
@@ -16,5 +16,7 @@
  *  specific language governing permissions and limitations
  *  under the License.
  ****************************************************************/
-CREATE ALIAS cayenne_tst_upd_proc FOR "org.apache.cayenne.unit.HSQLProcedures.cayenne_tst_upd_proc";
-CREATE ALIAS cayenne_tst_select_proc FOR "org.apache.cayenne.unit.HSQLProcedures.cayenne_tst_select_proc";
+DROP PROCEDURE IF EXISTS cayenne_tst_upd_proc;
+DROP PROCEDURE IF EXISTS cayenne_tst_select_proc;
+CREATE PROCEDURE cayenne_tst_upd_proc( IN paintingPrice INT ) LANGUAGE JAVA EXTERNAL NAME
'CLASSPATH:org.apache.cayenne.unit.HSQLProcedures.cayenne_tst_upd_proc';
+CREATE PROCEDURE cayenne_tst_select_proc( IN name VARCHAR(50), IN paintingPrice INT ) LANGUAGE
JAVA EXTERNAL NAME 'CLASSPATH:org.apache.cayenne.unit.HSQLProcedures.cayenne_tst_select_proc';
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/docs/doc/src/main/resources/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/docs/doc/src/main/resources/RELEASE-NOTES.txt b/docs/doc/src/main/resources/RELEASE-NOTES.txt
index c67b2b9..ac84187 100644
--- a/docs/doc/src/main/resources/RELEASE-NOTES.txt
+++ b/docs/doc/src/main/resources/RELEASE-NOTES.txt
@@ -13,6 +13,7 @@ Date:
 ----------------------------------
 Changes/New Features:
 
+CAY-2139 Upgrade HSQLDB dependency to the most recent version (2.3.4)
 CAY-2163 Property.path() , ExpressionFactory.pathExp()
 CAY-2164 Relocate builder bootstrap methods from ServerRuntimeBuilder to ServerRuntime
 CAY-2165 Explicit "contribution" API for easier expansion of DI collections and maps

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fdf3a89b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7b4042f..38b62cb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -468,9 +468,9 @@
 				<scope>provided</scope>
 			</dependency>
 			<dependency>
-				<groupId>hsqldb</groupId>
+				<groupId>org.hsqldb</groupId>
 				<artifactId>hsqldb</artifactId>
-				<version>1.8.0.4</version>
+				<version>2.3.4</version>
 				<scope>test</scope>
 			</dependency>
 			<dependency>
@@ -1215,9 +1215,9 @@
 			</activation>
 			<dependencies>
 				<dependency>
-					<groupId>hsqldb</groupId>
+					<groupId>org.hsqldb</groupId>
 					<artifactId>hsqldb</artifactId>
-					<version>1.8.0.4</version>
+					<version>2.3.4</version>
 					<scope>test</scope>
 				</dependency>
 			</dependencies>
@@ -1232,9 +1232,9 @@
 			</activation>
 			<dependencies>
 				<dependency>
-					<groupId>hsqldb</groupId>
+					<groupId>org.hsqldb</groupId>
 					<artifactId>hsqldb</artifactId>
-					<version>1.8.0.4</version>
+					<version>2.3.4</version>
 					<scope>test</scope>
 				</dependency>
 			</dependencies>


Mime
View raw message