Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
+1
person also asked this
people also asked this
Replies
5 replies
Subscribers
8 subscribers
Views
11892 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Integrations
I'm trying to use @SecondaryTable, hoping to join from a foreign key on my p
peterh
over 11 years ago
I'm trying to use @SecondaryTable, hoping to join from a foreign key on my primary table to the primary key on the secondary table. However it seems to ignore my referencedColumn annotation and joins to the primary key of my primary table. Is it not possible to use @SecondaryTable with something other than the primary key of the primary table?
DOC_TABLE:
DOC_ID (pk)
TYPE_ID (fk to LOOKUP_ID of LOOKUP table)
LOOKUP_TABLE:
LOOKUP_ID (pk)
DOMAIN_VALUE (field I want to show in my CDT).
CDT mapping:
<xsd:complexType name="TAX_Doc">
<xsd:annotation>
<xsd:appinfo source="appian.jpa">
@Table(name="DOC_TABLE")
@SecondaryTable(name="LOOKUP_TABLE", pkJoinColumns=@PrimaryKeyJoinColumn(name="LOOKUP_ID", referencedColumnName="TYPE_ID"))
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="id" type="xsd:int">
<xsd:annotation>
<xsd:appinfo source="appian.jpa">
@Column(name="DOC_ID", nullable=false)
...
OriginalPostID-81009
OriginalPostID-81009
Discussion posts and replies are publicly visible
Parents
0
lindat
over 10 years ago
After failing to get @SecondaryTable to work last year, I recently revisited it for another project in which I felt that it applied. I found Andre Dessens's comment very helpful because it made me realize that @SecondaryTable only applies to a very specific and limited use case: a single class/entity that is spread across multiple tables (see
en.wikibooks.org/.../Tables
. This means that the tables share the same key and are in a 1:1 relationship. I've been trying to use SecondaryTable when the relationship is actually N:1 e.g. the manager username for a particular user (see
en.wikibooks.org/.../Tables
I recommend that Appian make this very clear in their documentation (see
forum.appian.com/.../Create_Custom_Data_Types.html
where the current example is misleading) and in their Advanced Data Design training course.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
lindat
over 10 years ago
After failing to get @SecondaryTable to work last year, I recently revisited it for another project in which I felt that it applied. I found Andre Dessens's comment very helpful because it made me realize that @SecondaryTable only applies to a very specific and limited use case: a single class/entity that is spread across multiple tables (see
en.wikibooks.org/.../Tables
. This means that the tables share the same key and are in a 1:1 relationship. I've been trying to use SecondaryTable when the relationship is actually N:1 e.g. the manager username for a particular user (see
en.wikibooks.org/.../Tables
I recommend that Appian make this very clear in their documentation (see
forum.appian.com/.../Create_Custom_Data_Types.html
where the current example is misleading) and in their Advanced Data Design training course.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data