From 823572174735971e0503c241d6fa9652a35e0ff2 Mon Sep 17 00:00:00 2001 From: dionis Date: Fri, 6 Feb 2015 12:48:46 +0200 Subject: [PATCH] HHH-9602 - added new dialect for PostgreSQL 9.3 that supports materialized views & enable materialized view support. --- .../java/org/hibernate/dialect/Dialect.java | 20 +++++++++++++++++++ .../dialect/PostgreSQL93Dialect.java | 18 +++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL93Dialect.java diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java index f36e7de929..4416f79c3e 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java @@ -733,7 +733,27 @@ public abstract class Dialect implements ConversionContext { return SequenceStyleGenerator.class; } } + // Materialized view support + /** + * Does the dialect support materialized view. It's needed for schema validation purposes. + * @return True if dialect supports materialized views. False otherwise. + */ + public boolean supportsMaterializedView() { + return false; + } + + /** + * Does the dialect support materialized view. It's needed for schema validation purposes. + * @return Query string that will be passed as one of {@code String[] types} parameter + * to {@link java.sql.DatabaseMetaData#getTables(String, String, String, String[])}. {@code null} + * otherwise if dialect is not supported or doesn't need to use explicit type term. + */ + public String getMaterializedViewTypeTerm() { + return null; + } + + // End of Materialized view support // IDENTITY support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL93Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL93Dialect.java new file mode 100644 index 0000000000..dbde44a0cc --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL93Dialect.java @@ -0,0 +1,18 @@ +package org.hibernate.dialect; + +/** + * An SQL Dialect for PostgreSQL 9.3 and later. Adds support for Materialized view. + * + * @author Dionis Argiri + */ +public class PostgreSQL93Dialect extends PostgreSQL9Dialect { + @Override + public boolean supportsMaterializedView() { + return true; + } + + @Override + public String getMaterializedViewTypeTerm() { + return "MATERIALIZED VIEW"; + } +}