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
Replies
7 replies
Subscribers
9 subscribers
Views
6949 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
CDT Mapping Primary Key and Foreign Key
Ravi Roshan
over 8 years ago
I have a main table say ABC which has ID column as primary and identity. I have another table DEF where I have another column say CASE_ID which is both primary and foreign key but not the identity. In the second table DEF I have provide the reference as ABC.ID.
I have mapped the second table CDT DEF in CDT ABC, however while verifying the Data Store, I am getting the error "The data source schema does not match the type mappings: Missing column: CASE_ID in dbo.ABC (APNX-2-4056-000)"
My Requirement is to map the second table as @OneToOne Relationship with first table. Please find some screenshots for reference in attachment.
Please provide any solution for this. Thanks
OriginalPostID-261496
Discussion posts and replies are publicly visible
0
Puspendu Pal
over 8 years ago
I think the error is because you are missing the referencedColumnName="ID" in the @JoinColumn annotation. The system assumes the referenced column name as the same name if referencedColumnName is not specified.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Ravi Roshan
over 8 years ago
Hi Puspendu, @JoinColumn annotation is correct. The same approach I have implemented for other tables and it is working fine, the only difference is that in my second table the column is defined as both primary and foreign key. And in the XSD Level for other tables I have used oneToMany relationship, however for this case it is oneToOne relationship.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sanjays0006
over 8 years ago
Ravi, the screenshot is from the 1st table CDT?
If yes, then you should write the Join on the ID column(element name is secondcolumn here) as you mentioned right?
Can you provide the element declarations from both the CDT's so that we can have a look?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Ravi Roshan
over 8 years ago
Yes, First screen shot is of 1st Table. I guess @joinColumn(name: "CASE_ID") should be the column of secondTable which I have mentioned in type="tns:secondTable". Please find the element declaration for ID of firstTable and caseID of secondTable in attachment. The oneToOne declaration I have already provided in above screenshot.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Ravi Roshan
over 8 years ago
Same configuration is working fine when I use oneToMany configuration, however it is failing for OneToOne.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sanjays0006
over 8 years ago
Ravi,
One small question again. Is Case ID also Primary key in 2nd table?
Else, below thing worked for me.
Cancel
Vote Up
-1
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Ravi Roshan
over 8 years ago
Yes Sanjay,
In second table CaseID is primary key too. As per your screenshot I can understand that you have defined the @OneToOne relationship in your child table that is secondTable in my case.
I did not tried this approach, let me try and check.
Thanks for your inputs.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel