fix(manager-api-beans): add `@Type(type = "org.hibernate.type.TextType")` back for existing fields
But beware this may cause problems on other DBs, so need to re-test...
MODIFY
distro/data/src/main/resources/ddls/apiman_h2.ddl
distro/data/src/main/resources/ddls/apiman_h2.ddl
@@ -17,7 +17,7 @@ CREATE TABLE client_versions (id BIGINT NOT NULL, created_by VARCHAR(255) NOT NU
CREATE TABLE clients (id VARCHAR(255) NOT NULL, created_by VARCHAR(255) NOT NULL, created_on TIMESTAMP NOT NULL, description VARCHAR(512), name VARCHAR(255) NOT NULL, organization_id VARCHAR(255) NOT NULL);
-- Changeset src/main/liquibase/current/010-apiman-manager-api.db.tables.changelog.xml::1436469846462-3::apiman (generated)
-CREATE TABLE auditlog (id BIGINT NOT NULL, created_on TIMESTAMP NOT NULL, data CLOB, entity_id VARCHAR(255), entity_type VARCHAR(255) NOT NULL, entity_version VARCHAR(255), organization_id VARCHAR(255) NOT NULL, what VARCHAR(255) NOT NULL, who VARCHAR(255) NOT NULL);
+CREATE TABLE auditlog (id BIGINT NOT NULL, created_on TIMESTAMP NOT NULL, data VARCHAR(MAX), entity_id VARCHAR(255), entity_type VARCHAR(255) NOT NULL, entity_version VARCHAR(255), organization_id VARCHAR(255) NOT NULL, what VARCHAR(255) NOT NULL, who VARCHAR(255) NOT NULL);
-- Changeset src/main/liquibase/current/010-apiman-manager-api.db.tables.changelog.xml::1436469846462-4::apiman (generated)
CREATE TABLE contracts (id BIGINT NOT NULL, created_by VARCHAR(255) NOT NULL, created_on TIMESTAMP NOT NULL, clientv_id BIGINT, planv_id BIGINT, apiv_id BIGINT);
@@ -26,7 +26,7 @@ CREATE TABLE contracts (id BIGINT NOT NULL, created_by VARCHAR(255) NOT NULL, cr
CREATE TABLE endpoint_properties (api_version_id BIGINT NOT NULL, value VARCHAR(255), name VARCHAR(255) NOT NULL);
-- Changeset src/main/liquibase/current/010-apiman-manager-api.db.tables.changelog.xml::1436469846462-6::apiman (generated)
-CREATE TABLE gateways (id VARCHAR(255) NOT NULL, configuration CLOB NOT NULL, created_by VARCHAR(255) NOT NULL, created_on TIMESTAMP NOT NULL, description VARCHAR(512), modified_by VARCHAR(255) NOT NULL, modified_on TIMESTAMP NOT NULL, name VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL);
+CREATE TABLE gateways (id VARCHAR(255) NOT NULL, configuration VARCHAR(max) NOT NULL, created_by VARCHAR(255) NOT NULL, created_on TIMESTAMP NOT NULL, description VARCHAR(512), modified_by VARCHAR(255) NOT NULL, modified_on TIMESTAMP NOT NULL, name VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL);
-- Changeset src/main/liquibase/current/010-apiman-manager-api.db.tables.changelog.xml::1436469846462-7::apiman (generated)
CREATE TABLE memberships (id BIGINT NOT NULL, created_on TIMESTAMP, org_id VARCHAR(255), role_id VARCHAR(255), user_id VARCHAR(255));
@@ -50,7 +50,7 @@ CREATE TABLE plans (id VARCHAR(255) NOT NULL, created_by VARCHAR(255) NOT NULL,
CREATE TABLE plugins (id BIGINT NOT NULL, artifact_id VARCHAR(255) NOT NULL, classifier VARCHAR(255), created_by VARCHAR(255) NOT NULL, created_on TIMESTAMP NOT NULL, description VARCHAR(512), group_id VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, type VARCHAR(255), version VARCHAR(255) NOT NULL, deleted BOOLEAN);
-- Changeset src/main/liquibase/current/010-apiman-manager-api.db.tables.changelog.xml::1436469846462-14::apiman (generated)
-CREATE TABLE policies (id BIGINT NOT NULL, configuration CLOB, created_by VARCHAR(255) NOT NULL, created_on TIMESTAMP NOT NULL, entity_id VARCHAR(255) NOT NULL, entity_version VARCHAR(255) NOT NULL, modified_by VARCHAR(255) NOT NULL, modified_on TIMESTAMP NOT NULL, name VARCHAR(255) NOT NULL, order_index INT NOT NULL, organization_id VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, definition_id VARCHAR(255) NOT NULL);
+CREATE TABLE policies (id BIGINT NOT NULL, configuration VARCHAR(max), created_by VARCHAR(255) NOT NULL, created_on TIMESTAMP NOT NULL, entity_id VARCHAR(255) NOT NULL, entity_version VARCHAR(255) NOT NULL, modified_by VARCHAR(255) NOT NULL, modified_on TIMESTAMP NOT NULL, name VARCHAR(255) NOT NULL, order_index INT NOT NULL, organization_id VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, definition_id VARCHAR(255) NOT NULL);
-- Changeset src/main/liquibase/current/010-apiman-manager-api.db.tables.changelog.xml::1436469846462-15::apiman (generated)
CREATE TABLE policydefs (id VARCHAR(255) NOT NULL, description VARCHAR(512) NOT NULL, form VARCHAR(255), form_type VARCHAR(255), icon VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, plugin_id BIGINT, policy_impl VARCHAR(255) NOT NULL, deleted BOOLEAN);

MODIFY
manager/api/beans/src/main/java/io/apiman/manager/api/beans/audit/AuditEntryBean.java
manager/api/beans/src/main/java/io/apiman/manager/api/beans/audit/AuditEntryBean.java
@@ -69,7 +69,7 @@ public class AuditEntryBean implements Serializable {
private AuditEntryType what;
@Lob
@Column(updatable=false, nullable=true)
- // @Type(type = "org.hibernate.type.TextType")
+ @Type(type = "org.hibernate.type.TextType")
private String data;
/**

MODIFY
manager/api/beans/src/main/java/io/apiman/manager/api/beans/gateways/GatewayBean.java
manager/api/beans/src/main/java/io/apiman/manager/api/beans/gateways/GatewayBean.java
@@ -20,7 +20,6 @@ import io.apiman.common.util.crypt.DataEncryptionContext;
import java.io.Serializable;
import java.util.Date;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
@@ -34,10 +33,9 @@ import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;
-import org.hibernate.annotations.Type;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import org.hibernate.annotations.Type;
/**
* Models a single gateway configured by an admin. When publishing APIs,
@@ -73,7 +71,7 @@ public class GatewayBean implements Serializable {
private GatewayType type;
@Lob
@Column(updatable=true, nullable=false)
- // @Type(type = "org.hibernate.type.TextType")
+ @Type(type = "org.hibernate.type.TextType")
private String configuration;
/**

MODIFY
manager/api/beans/src/main/java/io/apiman/manager/api/beans/policies/PolicyBean.java
manager/api/beans/src/main/java/io/apiman/manager/api/beans/policies/PolicyBean.java
@@ -76,7 +76,7 @@ public class PolicyBean implements Serializable, Cloneable {
private String description;
@Lob
@Column(updatable=true, nullable=true)
- // @Type(type = "org.hibernate.type.TextType")
+ @Type(type = "org.hibernate.type.TextType")
private String configuration;
@Column(name = "created_by", updatable=false, nullable=false)
private String createdBy;

MODIFY
manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/ApimanH2Dialect.java
manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/ApimanH2Dialect.java
@@ -30,7 +30,7 @@ public class ApimanH2Dialect extends H2Dialect {
* Constructor.
*/
public ApimanH2Dialect() {
- // registerColumnType(Types.LONGVARCHAR, String.format("varchar(%d)", Integer.MAX_VALUE)); //$NON-NLS-1$
+ registerColumnType(Types.LONGVARCHAR, "varchar(max)"); //$NON-NLS-1$
registerColumnType(Types.VARBINARY, "BLOB");
registerColumnType(Types.NCLOB, "CLOB");
}

fix(manager-api-beans): add `@Type(type = "org.hibernate.type.TextType")` back for existing fields

But beware this may cause problems on other DBs, so need to re-test...

https://stackoverflow.com/questions/62045161/how-to-use-clob-with-hibernate-and-both-postgres-and-h2