Setting primary key

Hello ,

I have a requirement where i need to set the primary key of the cdt through an xsd and not using the interface .Which annotation can be used for the same ? I tried searching through existing CDT's for the setting primary key annotation but was not able to find one. Any help will be appreciated.

Thanks,

Rohit Ouhal

  Discussion posts and replies are publicly visible

Parents
  • Hi ,

    The following is an example of a typical XSD file where they have used @Id for setting the primary key:

    <xsd:schema xmlns:xsd="www.w3.org/.../XMLSchema"
    xmlns:tns="urn:com:appian:types:example"
    targetNamespace="urn:com:appian:types:example">
    <xsd:complexType name="Employee">
    <xsd:sequence>
    <xsd:element name="id" nillable="true" type="xsd:int">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">
    @Id
    @GeneratedValue
    </xsd:appinfo>
    </xsd:annotation>
    </xsd:element>
    <xsd:element name="firstName" type="xsd:string" />
    <xsd:element name="lastName" type="xsd:string" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>

    Is it the only solution you are looking for or you have any other requirement ?
Reply
  • Hi ,

    The following is an example of a typical XSD file where they have used @Id for setting the primary key:

    <xsd:schema xmlns:xsd="www.w3.org/.../XMLSchema"
    xmlns:tns="urn:com:appian:types:example"
    targetNamespace="urn:com:appian:types:example">
    <xsd:complexType name="Employee">
    <xsd:sequence>
    <xsd:element name="id" nillable="true" type="xsd:int">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">
    @Id
    @GeneratedValue
    </xsd:appinfo>
    </xsd:annotation>
    </xsd:element>
    <xsd:element name="firstName" type="xsd:string" />
    <xsd:element name="lastName" type="xsd:string" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>

    Is it the only solution you are looking for or you have any other requirement ?
Children
No Data