Appian Community and Appian Academy are being upgraded. As a part of the upgrade, Appian Community is currently in read-only mode, and user registration is disabled until August 3. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

Hi, I am trying to map a composite key from a different CDT to another one

Hi,
I am trying to map a composite key from a different CDT to another one using one unique key inside xsd. How do I do it? Two columns from one cdt form a composite pair and I have another foriegn key coming from that table which defines the relationship. I want to map this foriegn key to that parent table inside CDT. What all JPA annotations should I use to get this behavior. I tried my best looking up online and troubleshooting with various things like @EmbeddedId, @Embeddable,@XmlInverseReference(mappedBy="fk_key")....but none of them parsed through appian cdt parser. Any help would be deeply appreciated.

OriginalPostID-202003

OriginalPostID-202003

  Discussion posts and replies are publicly visible

Parents
  • @aswinb608 You can't map a composite key in the way you are attempting to. I believe the @Id annotation can only be used with a single column of, for example, string or integer.

    You could select one of the composite keys and map that as an @Id, but you could see odd behaviour, such as only getting a single row when that key is actually repeated several times. This can actually work, provided any query against that table always uses that key.

    Your other alternatives (as mentioned above) are to have a view created that provides a unique identifier, or to use the query database smart service.
Reply
  • @aswinb608 You can't map a composite key in the way you are attempting to. I believe the @Id annotation can only be used with a single column of, for example, string or integer.

    You could select one of the composite keys and map that as an @Id, but you could see odd behaviour, such as only getting a single row when that key is actually repeated several times. This can actually work, provided any query against that table always uses that key.

    Your other alternatives (as mentioned above) are to have a view created that provides a unique identifier, or to use the query database smart service.
Children
No Data