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
sikhivahans
over 11 years ago
@peterh, To my knowledge, @SecondaryTable can't be used for mapping non-primary key columns. And the reason why referencedColumn is ignored could be, when @SecondaryTable doesn't find any primary key join columns or a non-matching column (i.e. not the same column as Primary Key of the Primary Table), maps to primary key of the primary table. I think you have to go for a work around if you still want mappings to non-primary keys of the primary table.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
sikhivahans
over 11 years ago
@peterh, To my knowledge, @SecondaryTable can't be used for mapping non-primary key columns. And the reason why referencedColumn is ignored could be, when @SecondaryTable doesn't find any primary key join columns or a non-matching column (i.e. not the same column as Primary Key of the Primary Table), maps to primary key of the primary table. I think you have to go for a work around if you still want mappings to non-primary keys of the primary table.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data