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/22e030ce
Tree: http://git-wip-us.apache.org/repos/asf/ode/tree/22e030ce
Diff: http://git-wip-us.apache.org/repos/asf/ode/diff/22e030ce

Branch: refs/heads/ode-1.3.x
Commit: 22e030cef407314f511798a2c8d8f79f5d59cbdd
Parents: 355c775
Author: sathwik <[email protected]>
Authored: Tue Apr 5 11:50:43 2016 +0530
Committer: sathwik <[email protected]>
Committed: Tue Apr 5 11:50:43 2016 +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/22e030ce/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 d8fbb84..82be481 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/22e030ce/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