<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Setting primary key</title><link>https://community.appian.com/discussions/f/data/12638/setting-primary-key</link><description>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&amp;#39;s for the setting primary key annotation but was</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Setting primary key</title><link>https://community.appian.com/thread/56560?ContentTypeID=1</link><pubDate>Wed, 13 Jun 2018 13:40:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:63cc92ba-a75b-4e5b-91fe-a885fe263124</guid><dc:creator>Bindu</dc:creator><description>Hi Rohit,&lt;br /&gt;
&lt;br /&gt;
In the below link you find various annotations and their usage in Chapter No. 8. Hope it is helpful.&lt;br /&gt;
&lt;br /&gt;
Link:  &lt;a href="http://download.oracle.com/otn-pub/jcp/ejb-3_0-fr-eval-oth-JSpec/ejb-3_0-fr-spec-persistence.pdf?AuthParam=1528897271_67b00a9112b78f0737a22aed6c223922"&gt;download.oracle.com/.../ejb-3_0-fr-spec-persistence.pdf&lt;/a&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting primary key</title><link>https://community.appian.com/thread/56558?ContentTypeID=1</link><pubDate>Wed, 13 Jun 2018 11:42:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bff5839f-e5de-4162-8608-27c009629e23</guid><dc:creator>rommels</dc:creator><description>Hi Rohit,&lt;br /&gt;
&lt;br /&gt;
Use @GeneratedValue along with @Id &lt;br /&gt;
@Id &amp;gt;&amp;gt; It will set the field as primary key&lt;br /&gt;
@GeneratedValue &amp;gt;&amp;gt; It will set the primary key as auto increment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;xsd:element name=&amp;quot;Id&amp;quot; type=&amp;quot;xsd:int&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;xsd:annotation&amp;gt;&lt;br /&gt;
&amp;lt;xsd:appinfo source=&amp;quot;appian.jpa&amp;quot;&amp;gt;@Id @GeneratedValue @Column(name=&amp;quot;Id&amp;quot;)&amp;lt;/xsd:appinfo&amp;gt;&lt;br /&gt;
&amp;lt;/xsd:annotation&amp;gt;&lt;br /&gt;
&amp;lt;/xsd:element&amp;gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting primary key</title><link>https://community.appian.com/thread/56544?ContentTypeID=1</link><pubDate>Wed, 13 Jun 2018 06:07:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:59223719-3734-4e9d-9d22-934adea5fba3</guid><dc:creator>Shubham Aware</dc:creator><description>&lt;p&gt;Hello rohit,&lt;/p&gt;
&lt;p&gt;people have already given you an answer as @Id which is correct&lt;/p&gt;
&lt;p&gt;for future reference go through this&amp;nbsp;&amp;nbsp;&lt;a href="https://docs.appian.com/suite/help/18.2/Supported_XSD_Elements_and_JPA_Annotations.html"&gt;https://docs.appian.com/suite/help/18.2/Supported_XSD_Elements_and_JPA_Annotations.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting primary key</title><link>https://community.appian.com/thread/56542?ContentTypeID=1</link><pubDate>Wed, 13 Jun 2018 05:42:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e15edf0f-99d0-4a0d-a205-e748650296f3</guid><dc:creator>sushilkumarb</dc:creator><description>add @Id annotation before @Column(name=&amp;quot;columnName&amp;quot;, columnDefinition=&amp;quot;datatype&amp;quot;) in xsd  and do not add @Id for multiple columns else you will get error while publishing datastore.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting primary key</title><link>https://community.appian.com/thread/56497?ContentTypeID=1</link><pubDate>Tue, 12 Jun 2018 07:22:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7b957ed0-9d05-4072-bba6-c8dd59e95e4d</guid><dc:creator>rohitr303</dc:creator><description>Thanks alot for a quick response , it surely helped me.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting primary key</title><link>https://community.appian.com/thread/56496?ContentTypeID=1</link><pubDate>Tue, 12 Jun 2018 07:15:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:79ad3862-7a7f-4fe3-af23-c5b362dfc742</guid><dc:creator>krishnau3863</dc:creator><description>Hi rohitr303&lt;br /&gt;
&lt;br /&gt;
here is the code for generating primary key&lt;br /&gt;
&lt;br /&gt;
&amp;lt;xsd:element name=&amp;quot;id&amp;quot; nillable=&amp;quot;true&amp;quot; type=&amp;quot;xsd:int&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;xsd:annotation&amp;gt;&lt;br /&gt;
          &amp;lt;xsd:appinfo source=&amp;quot;appian.jpa&amp;quot;&amp;gt;@Id @GeneratedValue&amp;lt;/xsd:appinfo&amp;gt;&lt;br /&gt;
        &amp;lt;/xsd:annotation&amp;gt;&lt;br /&gt;
      &amp;lt;/xsd:element&amp;gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting primary key</title><link>https://community.appian.com/thread/56478?ContentTypeID=1</link><pubDate>Tue, 12 Jun 2018 06:05:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d4566198-25ad-4ba7-90c4-7e53761af3a4</guid><dc:creator>aratim</dc:creator><description>&lt;p&gt;Hi Rohit,&lt;br /&gt; @Id notation will be useful for defining primary key field.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting primary key</title><link>https://community.appian.com/thread/56441?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 11:28:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:76fc67f2-b518-44d3-927f-5f4dd055a695</guid><dc:creator>sravanis918</dc:creator><description>Hi,&lt;br /&gt;
&lt;br /&gt;
You can use the below code for setting the primary key through XSD:&lt;br /&gt;
&amp;lt;xsd:element name=&amp;quot;EmployeeId&amp;quot; nillable=&amp;quot;true&amp;quot; type=&amp;quot;xsd:int&amp;quot;&amp;gt;&amp;lt;xsd:annotation&amp;gt;&amp;lt;xsd:appinfo source=&amp;quot;appian.jpa&amp;quot;&amp;gt;@Id @GeneratedValue&amp;lt;/xsd:appinfo&amp;gt;&amp;lt;/xsd:annotation&amp;gt;&amp;lt;/xsd:element&amp;gt;&lt;br /&gt;
If you want that particular field to set as primary key and auto generated then you can use above code in XSD file.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting primary key</title><link>https://community.appian.com/thread/56433?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 10:42:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:de61eefa-430c-471e-99d4-182972904e2c</guid><dc:creator>ravalik</dc:creator><description>Hi rohitr,&lt;br /&gt;
&lt;br /&gt;
Please go through the link to get an idea on how to set the primary key.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="https://docs.appian.com/suite/help/18.2/Mapping_CDTs_to_Pre-defined_Database_Tables.html#primary-keys"&gt;docs.appian.com/.../Mapping_CDTs_to_Pre-defined_Database_Tables.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
ravalik&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting primary key</title><link>https://community.appian.com/thread/56425?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 10:09:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b4ee5dd0-fbbe-4cd6-bacd-ab0faaf066f0</guid><dc:creator>Smruti Swain</dc:creator><description>Hi Rohit,&lt;br /&gt;
My other fellow practitioners have already answered your query however for future use, I would suggest the reverse engineering approach where if you want to see these basic JPA notation usage in Appian XSD, what you could try, set the PK, autogenerated values for PK or FK references simply through create CDT from scratch option and then set what ever you want then generate the XSD of that CDT to see how it is configured in the XSD level. That might help.&lt;br /&gt;
Thanks&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting primary key</title><link>https://community.appian.com/thread/56423?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 09:47:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f6426649-161c-48cd-95a1-d55ab41a2725</guid><dc:creator>gurdeeps</dc:creator><description>Hi Rohit,&lt;br /&gt;
@Id notation should serve your purpose.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting primary key</title><link>https://community.appian.com/thread/56419?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 09:23:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9bde6d11-66d0-4aeb-950d-33255da12db6</guid><dc:creator>arikd398</dc:creator><description>Hi &lt;a href="/members/rohitr303"&gt;rohitr303&lt;/a&gt;,&lt;br /&gt;
&lt;br /&gt;
The following is an example of a typical XSD file where they have used @Id for setting the primary key:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;xsd:schema xmlns:xsd=&amp;quot;&lt;a href="http://www.w3.org/2001/XMLSchema&amp;quot;"&gt;www.w3.org/.../XMLSchema&amp;quot;&lt;/a&gt; &lt;br /&gt;
 xmlns:tns=&amp;quot;urn:com:appian:types:example&amp;quot; &lt;br /&gt;
 targetNamespace=&amp;quot;urn:com:appian:types:example&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;xsd:complexType name=&amp;quot;Employee&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;xsd:sequence&amp;gt;&lt;br /&gt;
      &amp;lt;xsd:element name=&amp;quot;id&amp;quot; nillable=&amp;quot;true&amp;quot; type=&amp;quot;xsd:int&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;xsd:annotation&amp;gt;&lt;br /&gt;
          &amp;lt;xsd:appinfo source=&amp;quot;appian.jpa&amp;quot;&amp;gt;&lt;br /&gt;
              @Id&lt;br /&gt;
              @GeneratedValue&lt;br /&gt;
          &amp;lt;/xsd:appinfo&amp;gt;&lt;br /&gt;
        &amp;lt;/xsd:annotation&amp;gt;&lt;br /&gt;
      &amp;lt;/xsd:element&amp;gt;&lt;br /&gt;
      &amp;lt;xsd:element name=&amp;quot;firstName&amp;quot; type=&amp;quot;xsd:string&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;xsd:element name=&amp;quot;lastName&amp;quot; type=&amp;quot;xsd:string&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/xsd:sequence&amp;gt;&lt;br /&gt;
  &amp;lt;/xsd:complexType&amp;gt;&lt;br /&gt;
&amp;lt;/xsd:schema&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Is it the only solution you are looking for or you have any other requirement ?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting primary key</title><link>https://community.appian.com/thread/56418?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 09:18:50 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:029fa819-ce8b-45ce-8368-7f2f1b3934d6</guid><dc:creator>namratak356</dc:creator><description>&lt;p&gt;Hi rohitr303 ,&lt;/p&gt;
&lt;p&gt;@Id, is used for setting Primary Key . Please find below an Example of Employee CDT , where id is set as Primary Key with JPA annotation &lt;span style="background-color:#ffff00;"&gt;@Id&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;xsd:schema xmlns:xsd=&amp;quot;&lt;a href="http://www.w3.org/2001/XMLSchema"&gt;www.w3.org/.../XMLSchema&lt;/a&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;xmlns:tns=&amp;quot;urn:com:appian:types:example&amp;quot;&lt;/p&gt;
&lt;p&gt;targetNamespace=&amp;quot;urn:com:appian:types:example&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;lt;xsd:complexType name=&amp;quot;Employee&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;lt;xsd:sequence&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;xsd:element name=&amp;quot;id&amp;quot; nillable=&amp;quot;true&amp;quot; type=&amp;quot;xsd:int&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;xsd:annotation&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;xsd:appinfo source=&amp;quot;appian.jpa&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="background-color:#ffff00;"&gt;@Id&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;@GeneratedValue&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/xsd:appinfo&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/xsd:annotation&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/xsd:element&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;xsd:element name=&amp;quot;firstName&amp;quot; type=&amp;quot;xsd:string&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;xsd:element name=&amp;quot;lastName&amp;quot; type=&amp;quot;xsd:string&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;lt;/xsd:sequence&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;lt;/xsd:complexType&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/xsd:schema&amp;gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting primary key</title><link>https://community.appian.com/thread/56417?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 09:09:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5728613f-e60b-413c-995b-976b42fd0679</guid><dc:creator>JayaKrishna</dc:creator><description>&amp;lt;xsd:appinfo source=&amp;quot;appian.jpa&amp;quot;&amp;gt;@Column(length=255) @Id&amp;lt;/xsd:appinfo&amp;gt;&lt;br /&gt;
@Id is the primarykey annotation&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting primary key</title><link>https://community.appian.com/thread/56416?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 09:05:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:03536db8-f020-4a97-acdf-f873c2dd1f07</guid><dc:creator>sankethv</dc:creator><description>Hello Rohit,&lt;br /&gt;
&lt;br /&gt;
@Id is the annotation used for setting the primary key. Please find below example where I am setting column REQUEST_ID as primary key:&lt;br /&gt;
    &amp;lt;xsd:element name=&amp;quot;requestID&amp;quot; nillable=&amp;quot;true&amp;quot; type=&amp;quot;xsd:int&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;xsd:annotation&amp;gt;&lt;br /&gt;
          &amp;lt;xsd:appinfo source=&amp;quot;appian.jpa&amp;quot;&amp;gt;@Id @GeneratedValue @Column(name=&amp;quot;REQUEST_ID&amp;quot;)&amp;lt;/xsd:appinfo&amp;gt;&lt;br /&gt;
        &amp;lt;/xsd:annotation&amp;gt;&lt;br /&gt;
      &amp;lt;/xsd:element&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also, find the related documentation at &lt;a href="https://docs.appian.com/suite/help/18.2/Supported_XSD_Elements_and_JPA_Annotations.html"&gt;docs.appian.com/.../Supported_XSD_Elements_and_JPA_Annotations.html&lt;/a&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting primary key</title><link>https://community.appian.com/thread/56415?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 09:01:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0c49df35-b971-4aa9-94dc-90855b2189bc</guid><dc:creator>vinayr214137</dc:creator><description>Hi Rohit,&lt;br /&gt;
&lt;br /&gt;
Use @Id notation for Primary Key&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>