Studio created wrong DDL scripts with inheritance and long entity names


i found a bug when using studio in the following environment:

  • Entity Inheritance with JOINED inheritance strategy
  • long Class Names

Here is the example (created through studio):

@DiscriminatorColumn(name = "DTYPE", discriminatorType = DiscriminatorType.STRING)
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "CPHRT_CUSTOMER")
@Entity(name = "cphrt$Customer")
public class Customer extends StandardEntity {
    private static final long serialVersionUID = -4346854472549283411L;

    @Column(name = "NAME")
    protected String name;

    public void setName(String name) { = name;

    public String getName() {
        return name;

@PrimaryKeyJoinColumn(name = "ID", referencedColumnName = "ID")
@Entity(name = "cphrt$BigCustomerWithVeryVeryLongName")
public class BigCustomerWithVeryVeryLongName extends Customer {
    private static final long serialVersionUID = -1809242922437052223L;

    @Column(name = "HOW_BIG")
    protected Integer howBig;

    public void setHowBig(Integer howBig) {
        this.howBig = howBig;

    public Integer getHowBig() {
        return howBig;


the DDL scripts:

create table CPHRT_CUSTOMER (
    ID varchar(36) not null,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    DTYPE varchar(31),
    NAME varchar(255),
    primary key (ID)
    ID varchar(36) not null,
    HOW_BIG integer,
    primary key (ID)

The problem seem to be the line where it defines the length of the DTYPE. I saw that sometimes this has been created with length 100 from studio, then it worked. This seems to be when don’t specifiing a inheritance strategy in the first place in Studio.
But if directly choosing a JOINED strategy, or trying to remove the JOINED strategy afterwards does not trigger the code that will expand the DTYPE column.

Attached you will find the example project.

Perhaps you can take a look at it.

Mario (43.4K)

Hi, Mario.
The problem is known.
Its fix will be delivered in Studio 6.6.0 (see the linked YouTrack issue).
Studio will force the user to specify a correct Dtype value.

Thank you.

1 Like

:ticket: See the following issue in our bug tracker:

Hi fellas,
why did you not support proper SQL generation for the length attribute @DiscriminatorColumn annotation?

Checked with Studio 6.7.x - the length for DTYPE column in SQL-scripts is still the same regardless specifying the length property:

@DiscriminatorColumn(name = "DTYPE", discriminatorType = DiscriminatorType.STRING, length = 100)

Thanks in advance.