ODE-1056: Custom postgreSQL dialect to mark BLOB as BYTEA instead of OID

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

Branch: refs/heads/master
Commit: 4f88cdabae8886634c130a3ada970f01384e2f7f
Parents: 1761003
Author: sathwik <[email protected]>
Authored: Wed Jun 28 16:17:10 2017 +0530
Committer: sathwik <[email protected]>
Committed: Wed Jun 28 16:17:10 2017 +0530

----------------------------------------------------------------------
 .../src/main/sql/ode.postgres.properties        |  2 +-
 .../daohib/dialect/CustomDialectPostgreSQL.java | 32 ++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ode/blob/4f88cdab/dao-hibernate-db/src/main/sql/ode.postgres.properties
----------------------------------------------------------------------
diff --git a/dao-hibernate-db/src/main/sql/ode.postgres.properties 
b/dao-hibernate-db/src/main/sql/ode.postgres.properties
index 229d2b4..b0b3dbf 100644
--- a/dao-hibernate-db/src/main/sql/ode.postgres.properties
+++ b/dao-hibernate-db/src/main/sql/ode.postgres.properties
@@ -31,7 +31,7 @@
 #hibernate.dialect=org.hibernate.dialect.OracleDialect
 #hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
 #hibernate.dialect=org.hibernate.dialect.SQLServerDialect
-hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
+hibernate.dialect=org.apache.ode.daohib.dialect.CustomDialectPostgreSQL
 #hibernate.dialect=org.hibernate.dialect.SybaseDialect
 
 #Enable SQL-level debug logging (uncomment for logging)

http://git-wip-us.apache.org/repos/asf/ode/blob/4f88cdab/dao-hibernate/src/main/java/org/apache/ode/daohib/dialect/CustomDialectPostgreSQL.java
----------------------------------------------------------------------
diff --git 
a/dao-hibernate/src/main/java/org/apache/ode/daohib/dialect/CustomDialectPostgreSQL.java
 
b/dao-hibernate/src/main/java/org/apache/ode/daohib/dialect/CustomDialectPostgreSQL.java
new file mode 100644
index 0000000..10be46b
--- /dev/null
+++ 
b/dao-hibernate/src/main/java/org/apache/ode/daohib/dialect/CustomDialectPostgreSQL.java
@@ -0,0 +1,32 @@
+/*
+ * 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.PostgreSQLDialect;
+
+public class CustomDialectPostgreSQL extends PostgreSQLDialect {
+
+    public CustomDialectPostgreSQL() {
+        super();
+        registerColumnType( Types.BLOB, "bytea" );
+    }
+}

Reply via email to