Repository: ambari
Updated Branches:
  refs/heads/trunk ce3e14370 -> 5226ae1be


AMBARI-10918. Ambari with DB as oracle is failing to deploy. (swagle)


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

Branch: refs/heads/trunk
Commit: 0c39d4ef5343c8fb055cd2581538ae26d9a77fba
Parents: ce3e143
Author: Siddharth Wagle <swa...@hortonworks.com>
Authored: Mon May 4 17:52:40 2015 -0700
Committer: Siddharth Wagle <swa...@hortonworks.com>
Committed: Mon May 4 17:52:40 2015 -0700

----------------------------------------------------------------------
 .../ambari/server/orm/dao/ServiceConfigDAO.java      |  7 ++++---
 .../ambari/server/orm/entities/WidgetEntity.java     | 15 ++++++++++++---
 .../ambari/server/upgrade/UpgradeCatalog210.java     |  6 +++---
 .../src/main/resources/Ambari-DDL-MySQL-CREATE.sql   |  4 ++--
 .../src/main/resources/Ambari-DDL-Oracle-CREATE.sql  |  4 ++--
 .../main/resources/Ambari-DDL-Postgres-CREATE.sql    |  4 ++--
 .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql          |  4 ++--
 7 files changed, 27 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0c39d4ef/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
index 8f8e196..db0817b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
@@ -18,6 +18,7 @@
 
 package org.apache.ambari.server.orm.dao;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -212,13 +213,13 @@ public class ServiceConfigDAO {
    */
   @RequiresSession
   public Long findNextServiceConfigVersion(long clusterId, String serviceName) 
{
-    TypedQuery<Long> query = entityManagerProvider.get().createNamedQuery(
-        "ServiceConfigEntity.findNextServiceConfigVersion", Long.class);
+    TypedQuery<Number> query = entityManagerProvider.get().createNamedQuery(
+        "ServiceConfigEntity.findNextServiceConfigVersion", Number.class);
 
     query.setParameter("clusterId", clusterId);
     query.setParameter("serviceName", serviceName);
 
-    return daoUtils.selectSingle(query);
+    return daoUtils.selectSingle(query).longValue();
   }
 
   @Transactional

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c39d4ef/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/WidgetEntity.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/WidgetEntity.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/WidgetEntity.java
index 397d845..b65a87b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/WidgetEntity.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/WidgetEntity.java
@@ -17,13 +17,16 @@
  */
 package org.apache.ambari.server.orm.entities;
 
+import javax.persistence.Basic;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
+import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
+import javax.persistence.Lob;
 import javax.persistence.ManyToOne;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
@@ -67,7 +70,9 @@ public class WidgetEntity {
   @Column(name = "widget_type", nullable = false, length = 255)
   private String widgetType;
 
-  @Column(name = "metrics", length = 32672)
+  @Lob
+  @Basic(fetch = FetchType.LAZY)
+  @Column(name = "metrics")
   private String metrics;
 
   @Column(name = "time_created", nullable = false, length = 255)
@@ -85,10 +90,14 @@ public class WidgetEntity {
   @Column(name = "scope", length = 255)
   private String scope;
 
-  @Column(name = "widget_values", length = 4000)
+  @Lob
+  @Basic(fetch = FetchType.LAZY)
+  @Column(name = "widget_values")
   private String widgetValues;
 
-  @Column(name = "properties", length = 4000)
+  @Lob
+  @Basic(fetch = FetchType.LAZY)
+  @Column(name = "properties")
   private String properties;
 
   @Column(name = "cluster_id", nullable = false)

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c39d4ef/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
index dc7f7a9..0845e4b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
@@ -498,14 +498,14 @@ public class UpgradeCatalog210 extends 
AbstractUpgradeCatalog {
     columns.add(new DBColumnInfo("id", Long.class,    null,  null, false));
     columns.add(new DBColumnInfo("widget_name", String.class,  255,   null, 
false));
     columns.add(new DBColumnInfo("widget_type", String.class,  255,   null, 
false));
-    columns.add(new DBColumnInfo("metrics", String.class,  32672,   null, 
true));
+    columns.add(new DBColumnInfo("metrics", byte[].class,  null,   null, 
true));
     columns.add(new DBColumnInfo("time_created", Long.class,  null,   null, 
false));
     columns.add(new DBColumnInfo("author", String.class,  255,   null, true));
     columns.add(new DBColumnInfo("description", String.class,  255,   null, 
true));
     columns.add(new DBColumnInfo("display_name", String.class,  255,   null, 
true));
     columns.add(new DBColumnInfo("scope", String.class,  255,   null, true));
-    columns.add(new DBColumnInfo("widget_values", String.class,  4000,   null, 
true));
-    columns.add(new DBColumnInfo("properties", String.class,  4000,   null, 
true));
+    columns.add(new DBColumnInfo("widget_values", byte[].class,  null,   null, 
true));
+    columns.add(new DBColumnInfo("properties", byte[].class, null, null, 
true));
     columns.add(new DBColumnInfo("cluster_id", Long.class,  null,   null, 
false));
     dbAccessor.createTable(WIDGET_TABLE, columns, "id");
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c39d4ef/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 
b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
index 7f00b10..d32f3cd 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -551,8 +551,8 @@ CREATE TABLE widget (
   description VARCHAR(255),
   display_name VARCHAR(255),
   scope VARCHAR(255),
-  widget_values VARCHAR(4000),
-  properties VARCHAR(4000),
+  widget_values LONGTEXT,
+  properties LONGTEXT,
   cluster_id BIGINT NOT NULL,
   PRIMARY KEY(id)
 );

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c39d4ef/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql 
b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
index c0313e5..4317c83 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -541,8 +541,8 @@ CREATE TABLE widget (
   description VARCHAR2(255),
   display_name VARCHAR2(255),
   scope VARCHAR2(255),
-  widget_values VARCHAR2(4000),
-  properties VARCHAR2(4000),
+  widget_values CLOB,
+  properties CLOB,
   cluster_id NUMBER(19) NOT NULL,
   PRIMARY KEY(id)
 );

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c39d4ef/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql 
b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index 94e4884..e3cef5d 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -550,8 +550,8 @@ CREATE TABLE widget (
   description VARCHAR(255),
   display_name VARCHAR(255),
   scope VARCHAR(255),
-  widget_values VARCHAR(4000),
-  properties VARCHAR(4000),
+  widget_values TEXT,
+  properties TEXT,
   cluster_id BIGINT NOT NULL,
   PRIMARY KEY(id)
 );

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c39d4ef/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql 
b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
index 54c8c40..77186a1 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
@@ -626,8 +626,8 @@ CREATE TABLE ambari.widget (
   description VARCHAR(255),
   display_name VARCHAR(255),
   scope VARCHAR(255),
-  widget_values VARCHAR(4000),
-  properties VARCHAR(4000),
+  widget_values TEXT,
+  properties TEXT,
   cluster_id BIGINT NOT NULL,
   PRIMARY KEY(id)
 );

Reply via email to