<?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>Creating 1-1 Nested CDT from Existing Tables--Avoiding Extra DB Column in Parent</title><link>https://community.appian.com/discussions/f/data/13921/creating-1-1-nested-cdt-from-existing-tables--avoiding-extra-db-column-in-parent</link><description>Hello, 
 Suppose I have a existing &amp;quot;Person&amp;quot; and &amp;quot;Account&amp;quot; CDTs that use a foreign key. 
 Person: id, name, etc... 
 Account: id, personId, number, etc... 
 
 I want to create a separate nested CDT that is &amp;quot;Person&amp;quot;, but contains &amp;quot;account&amp;quot; information.</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Creating 1-1 Nested CDT from Existing Tables--Avoiding Extra DB Column in Parent</title><link>https://community.appian.com/thread/63210?ContentTypeID=1</link><pubDate>Wed, 05 Dec 2018 20:56:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bc5eddd6-79a2-45b4-ada5-d4ed3eeb8f89</guid><dc:creator>Evan Rust</dc:creator><description>Thank you.  I suspected that I would not be able to &amp;quot;pick&amp;quot; my parent in this situation.  As a workaround, I have created a database view.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Creating 1-1 Nested CDT from Existing Tables--Avoiding Extra DB Column in Parent</title><link>https://community.appian.com/thread/63209?ContentTypeID=1</link><pubDate>Wed, 05 Dec 2018 20:47:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ef40d9c1-ef34-46b2-80e1-6aee7354ef46</guid><dc:creator>omere0001</dc:creator><description>Unless your Person CDT/table has a field for accountID your Person CDT cannot be the parent. From what you listed it looks like your parent CDT would be Account and Person would be the nested CDT joined on the personId column.&lt;br /&gt;
&lt;br /&gt;
Also, if you have a one to many relationship, you should keep cascadeType=REFRESH. If you use cascadeType=ALL and delete the parent entity, all the child entities will also be deleted.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Creating 1-1 Nested CDT from Existing Tables--Avoiding Extra DB Column in Parent</title><link>https://community.appian.com/thread/63188?ContentTypeID=1</link><pubDate>Wed, 05 Dec 2018 01:44:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8f1dcae8-fe17-4520-b733-5eb7621ca407</guid><dc:creator>anjannat</dc:creator><description>&lt;p&gt;Hi, you can use @JoinColumn annotation in parent cdt to link between parent and child cdt&lt;/p&gt;
&lt;p&gt;Below is sample one, you can change it accordingly if it is one-one,&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;lt;xsd:element maxOccurs=&amp;quot;unbounded&amp;quot; minOccurs=&amp;quot;0&amp;quot; name=&amp;quot;person&amp;quot; type=&amp;quot;tns:Account&amp;quot;&amp;gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;xsd:annotation&amp;gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;xsd:appinfo source=&amp;quot;appian.jpa&amp;quot;&amp;gt;@OneToMany(cascade=CascadeType.ALL, indexed=false) @JoinColumn(name=&amp;quot;personId&amp;quot;)&amp;lt;/xsd:appinfo&amp;gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/xsd:annotation&amp;gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/xsd:element&amp;gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;Anji&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>