ODE-1055: Added a custom Derby dialect to generate blob and clob column with 
Database's default max length


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

Branch: refs/heads/master
Commit: 1761003f261668afdcadaf846f7bdfd6a23b8ac9
Parents: bff6fab
Author: sathwik <[email protected]>
Authored: Wed Jun 28 16:12:42 2017 +0530
Committer: sathwik <[email protected]>
Committed: Wed Jun 28 16:12:42 2017 +0530

----------------------------------------------------------------------
 .../src/main/sql/ode.derby.properties           |  2 +-
 .../ode/daohib/dialect/CustomDialectDerby.java  | 34 ++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ode/blob/1761003f/dao-hibernate-db/src/main/sql/ode.derby.properties
----------------------------------------------------------------------
diff --git a/dao-hibernate-db/src/main/sql/ode.derby.properties 
b/dao-hibernate-db/src/main/sql/ode.derby.properties
index 4a988bb..b9d96d9 100644
--- a/dao-hibernate-db/src/main/sql/ode.derby.properties
+++ b/dao-hibernate-db/src/main/sql/ode.derby.properties
@@ -25,7 +25,7 @@
 # The type of database we are connecting to, uncomment the
 # correct one:
 
-hibernate.dialect=org.hibernate.dialect.DerbyDialect
+hibernate.dialect=org.apache.ode.daohib.dialect.CustomDialectDerby
 #hibernate.dialect=org.hibernate.dialect.MySQLDialect
 #hibernate.dialect=org.hibernate.dialect.HSQLDialect
 #hibernate.dialect=org.hibernate.dialect.OracleDialect

http://git-wip-us.apache.org/repos/asf/ode/blob/1761003f/dao-hibernate/src/main/java/org/apache/ode/daohib/dialect/CustomDialectDerby.java
----------------------------------------------------------------------
diff --git 
a/dao-hibernate/src/main/java/org/apache/ode/daohib/dialect/CustomDialectDerby.java
 
b/dao-hibernate/src/main/java/org/apache/ode/daohib/dialect/CustomDialectDerby.java
new file mode 100644
index 0000000..e01316c
--- /dev/null
+++ 
b/dao-hibernate/src/main/java/org/apache/ode/daohib/dialect/CustomDialectDerby.java
@@ -0,0 +1,34 @@
+/*
+ * 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.ode.daohib.dialect;
+
+import java.sql.Types;
+
+import org.hibernate.dialect.DerbyDialect;
+
+public class CustomDialectDerby extends DerbyDialect {
+
+public CustomDialectDerby() {
+        super();
+        //workaround from HHH-2614 & HHH-7264
+        registerColumnType(Types.CLOB, "clob");
+        registerColumnType(Types.BLOB, "blob");
+    }
+}

Reply via email to