Cannot create a uniquecontraint with fields from MappedSuperClass and Concrete Entity

Hi,
my environment is

  • studio 11
  • platform 7.0.9
  • db hsqlDB
  • plugin multitenancy

I have a problem with the multi-tenancy add-on but I think it is due to entity inheritance vs the entity designer.

I have a Tenant Specific Entity. It inherits from MappedSuperClass StandardTenantEntity.
I would like to have a field unique within each tenant (not across all tenants)

I can’t do that because I cannot create an unique constraint using

  • the field tenantId of the base MappedSuperClass StandardTenantEntity
  • the field of my concrete class.

I tried to add this in the Java Editor of my entity

@Table(
name = “MY_TABLE”,
uniqueConstraints={
@UniqueConstraint(columnNames={“TENANT_ID”, “MY_COLUMN_NAME”})
}
)

==> nothing generated in sql part.

And if I go to the Designer view and then go back to the java editor, then I have :

@Table(name = “MY_TABLE” )

Is it a bug or what should I do?

Regards,
guillaume

Hi

Did you try to create the unique constraint using Indexes Editor?
Select Indexes tab at the bottom of your entity editor.
Create new index, select attributes and mark Unique checkbox.

The name attribute is missing in your unique constraint definition. That is why it doesn’t present in sql scripts.

indexes source ddl

HI,
It works.
I though I tested it but I might be wrong !

Thanks for the reply

Guillaume