How to auto set the PK Id on create

Hello,

I have a table with PK id, so on creating new instances I see the Id field is empty.
How can I auto set the Id on create operation.

Thanks.

Hi,

What is the base class of your entity? How PK is defined in the table?

Hi,

The entity extends BaseStringIdEntity and the primary key is defined like this -

@Id
@Column(name = “id”, nullable = false, length = 150)
protected String id;

I see. For entities having String PK the platform does not assign id automatically. You have to do it programmatically by your own rules or just display this field on an editor screen for users to be able to enter it.