Question
when to use @ID & @GeneratedValue annotations appian?
A
Anonymous
December 18, 2025

Answer

Use the @Id annotation to designate a specific field within your CDT as the primary key for the corresponding database table. Every entity (CDT) mapped to a data store must have a primary key defined.


Use the @GeneratedValue annotation alongside @Id when you want the database to automatically generate the unique identifier for new records. This is the standard practice for auto-incrementing integer or sequence-generated primary keys


Sample CDT Configuration

<xsd:element name="formId" nillable="true" type="xsd:int">
<xsd:annotation>
<xsd:appinfo source="appian.jpa">@Id @GeneratedValue @Column(name="FORM_ID", nullable=false, unique=true, columnDefinition="INT UNSIGNED")</xsd:appinfo>
</xsd:annotation>
</xsd:element>
JuniorData Type
Loading comments...