Type not found or user lacks privilege: TEXT

46 Views Asked by At

I am trying to use hsqldb-2.5.1 to connect from Spring application. One of the domain object is having field as type text[]. So while creating that table in PUBLIC schema by hsql I am getting this exception as "type not found or user lacks privilege's: TEXT"

I tried "sql.syntax_pgs=true" with data source url but getting a different exception as "unexpected token [". Not sure what else to try and fix this issue with.

Sample ddl command:

create table PUBLIC.abcs (id bigint not null, createdBy varchar(255), createdDate timestamp, lastModifiedBy varchar(255), lastModifiedDate timestamp, columnName varchar(35) not null, types text[] not null, methId varchar(255), paraValues text[], tables int8[] not null, prId bigint not null, primary key (id))

Sample Domain object:

@Entity
@Table(name = "abcs")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Indexed
public class Abc extends LongEntity<Abc> {

    private static final long serialVersionUID = 1L;

    @Column(name = "columnName", length = ColumnName.MAX_DB_LENGTH, nullable = false)
    private String columnName;

    @Column(name = "tables", nullable = false, columnDefinition = "int8[]")
    @Type(type = "com.pkg.GenericArrayUserType", parameters = {
            @Parameter(name = "type", value = "bigint")
    })
    private Long[] abcIds;

    @Column(name = "types", nullable = false, columnDefinition = "text[]")
    @Type(type = "com.pkg.GenericArrayUserType", parameters = {
            @Parameter(name = "type", value = "text")
    })
    private String[] daTypes;
}
1

There are 1 best solutions below

0
fredt On

If the columns with int8[] or text[] types are arrays, use the keyword ARRAY.

create table PUBLIC.abcs 
  (id bigint not null, createdBy varchar(255), createdDate timestamp,
  lastModifiedBy varchar(255), lastModifiedDate timestamp, 
  columnName varchar(35) not null, types text ARRAY not null, 
  methId varchar(255), paraValues text ARRAY, tables int8 ARRAY not null,
  prId bigint not null,
  primary key (id))